Esp32 Access Point als Arduino Tab.
Connect.ino
// ****************************************************************
// Sketch Esp32 Access Point Modular(Tab)
// created: Jens Fleischer, 2020-03-29
// last mod: Jens Fleischer, 2020-03-29
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 1.0.4
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
Copyright (c) 2020 Jens Fleischer. All rights reserved.
This file is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Access Point sollte als Tab eingebunden werden.
// #include <WebServer.h> sollte im Haupttab aufgerufen werden
// Dieser AP kann mit dem ESP32 Webserver betrieben werden.
// Die Funktion "Connect();" muss im Setup eingebunden werden.
/**************************************************************************************/
const char *ssid = "Esp32AP"; // << kann bis zu 32 Zeichen haben
const char *password = "Passphrase"; // << mindestens 8 Zeichen jedoch nicht länger als 64 Zeichen
//#define CONFIG // Einkommentieren falls die Standard Konfiguration des Esp32 überschrieben werden soll.
#ifdef CONFIG
IPAddress apIPv4(10, 0, 0, 0); // eigene IP des Esp32 Access Point
IPAddress subnet(255, 0, 0, 0); // Subnetzmaske des Netzwerkes
const char *hostName = "Zentrale"; // eigener Hostname
#endif
void Connect() { // Funktionsaufruf "Connect();" muss im Setup nach "spiffs();" eingebunden werden
WiFi.mode(WIFI_AP);
#ifdef CONFIG
WiFi.softAPConfig(apIPv4, apIPv4, subnet);
WiFi.softAPsetHostname(hostName);
#endif
if (WiFi.softAP(ssid, password)) {
DEBUG_F("Verbinde dich mit dem Netzwerk \"%s\"\nGib die IP %s im Browser ein\n\n", ssid, WiFi.softAPIP().toString().c_str());
DEBUG_F("Hostname des AP = %s\n", WiFi.softAPgetHostname());
DEBUG_P("Mac Adresse des AP = " + WiFi.softAPmacAddress());
DEBUG_P("Broadcast IP des AP = " + WiFi.softAPBroadcastIP().toString());
} else {
DEBUG_P("Fehler beim erstellen.");
}
}