| @@ -0,0 +1,106 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
| <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | |||
| <storageModule moduleId="org.eclipse.cdt.core.settings"> | |||
| <cconfiguration id="io.sloeber.core.sketch.0"> | |||
| <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="io.sloeber.core.sketch.0" moduleId="org.eclipse.cdt.core.settings" name="Release"> | |||
| <externalSettings/> | |||
| <extensions> | |||
| <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | |||
| <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |||
| <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |||
| <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |||
| </extensions> | |||
| </storageModule> | |||
| <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |||
| <configuration artifactName="${ProjName}" buildProperties="" cleanCommand="rm -f" description="" id="io.sloeber.core.sketch.0" name="Release" parent="io.sloeber.core.configuration.release"> | |||
| <folderInfo id="io.sloeber.core.sketch.0." name="/" resourcePath=""> | |||
| <toolChain id="io.sloeber.core.toolChain.release.816937340" name="Arduino Toolchain (Sloeber edition)" superClass="io.sloeber.core.toolChain.release"> | |||
| <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="io.sloeber.targetplatform.1404519782" name="Arduino Target" osList="all" superClass="io.sloeber.targetplatform"/> | |||
| <builder buildPath="${workspace_loc:/LEDLamp}/Release" id="io.sloeber.sketch.builder.1880584505" keepEnvironmentInBuildfile="false" name="Arduino sketch builder" parallelBuildOn="false" superClass="io.sloeber.sketch.builder"/> | |||
| <tool id="io.sloeber.tool.sketch.compiler.cpp.1540741071" name="Arduino C++ Compiler" superClass="io.sloeber.tool.sketch.compiler.cpp"> | |||
| <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.cpp.sketch.option.incpath.1935522056" name="Include Paths (-I)" superClass="io.sloeber.compiler.cpp.sketch.option.incpath" valueType="includePath"> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/core/variant}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/core/core}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/ESP8266WiFi/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/ESP8266WebServer/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/EEPROM}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/DNSServer/src}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.cpp.sketch.input.1770649762" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/> | |||
| </tool> | |||
| <tool id="io.sloeber.tool.compiler.c.1882603549" name="Arduino C Compiler" superClass="io.sloeber.tool.compiler.c"> | |||
| <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.c.sketch.option.incpath.225042047" name="Include Paths (-I)" superClass="io.sloeber.compiler.c.sketch.option.incpath" valueType="includePath"> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/core/variant}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/core/core}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/ESP8266WiFi/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/ESP8266WebServer/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/EEPROM}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/DNSServer/src}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.c.sketch.input.1705705" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/> | |||
| </tool> | |||
| <tool id="io.sloeber.tool.sketch.compiler.s.1033602739" name="Arduino Assembler" superClass="io.sloeber.tool.sketch.compiler.s"> | |||
| <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.asm.sketch.option.incpath.328612697" name="Include Paths (-I)" superClass="io.sloeber.compiler.asm.sketch.option.incpath" valueType="includePath"> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/core/variant}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/core/core}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/ESP8266WiFi/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/ESP8266WebServer/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/EEPROM}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/LEDLamp/libraries/DNSServer/src}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.S.sketch.input.1190005390" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/> | |||
| </tool> | |||
| <tool id="io.sloeber.tool.ar.514969585" name="Arduino archiver" superClass="io.sloeber.tool.ar"/> | |||
| <tool id="io.sloeber.tool.combine.1948275152" name="Arduino combiner" superClass="io.sloeber.tool.combine"/> | |||
| <tool id="io.sloeber.tool.objcopy.eep.1139530296" name="Arduino tool objcopy command" superClass="io.sloeber.tool.objcopy.eep"/> | |||
| <tool id="io.sloeber.tool.size.1029180469" name="Arduino tool Print Size" superClass="io.sloeber.tool.size"/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/**/._*" resourcePath="libraries/**/._*"> | |||
| <toolChain id="io.sloeber.core.toolChain5.1209827109" superClass="io.sloeber.core.toolChain5"> | |||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/**/._*.1925306198" name=""/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/test*/**" resourcePath="libraries/?*/**/test*/**"> | |||
| <toolChain id="io.sloeber.core.toolChain3.763945054" superClass="io.sloeber.core.toolChain3"> | |||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/test*/**.2127203078" name=""/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/?xtras/**" resourcePath="libraries/?*/**/?xtras/**"> | |||
| <toolChain id="io.sloeber.core.toolChain2.384401881" superClass="io.sloeber.core.toolChain2"> | |||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/?xtras/**.1837421639" name=""/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/?xamples/**" resourcePath="libraries/?*/**/?xamples/**"> | |||
| <toolChain id="io.sloeber.core.toolChain1.30873918" superClass="io.sloeber.core.toolChain1"> | |||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/?xamples/**.1548566557" name=""/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/third-party/**" resourcePath="libraries/?*/**/third-party/**"> | |||
| <toolChain id="io.sloeber.core.toolChain4.1323350237" superClass="io.sloeber.core.toolChain4"> | |||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/third-party/**.426112813" name=""/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/utility/*/*" resourcePath="libraries/?*/utility/*/*"> | |||
| <toolChain id="io.sloeber.core.toolChain6.1175006788" superClass="io.sloeber.core.toolChain6"> | |||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/utility/*/*.1520476848" name=""/> | |||
| </toolChain> | |||
| </folderInfo> | |||
| <sourceEntries> | |||
| <entry excluding="libraries/?*/**/?xamples/**|libraries/?*/**/?xtras/**|libraries/?*/**/test*/**|libraries/?*/**/third-party/**|libraries/**/._*|libraries/?*/utility/*/*" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> | |||
| </sourceEntries> | |||
| </configuration> | |||
| </storageModule> | |||
| <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |||
| </cconfiguration> | |||
| </storageModule> | |||
| <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> | |||
| <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |||
| <project id="LEDLamp.io.sloeber.core.sketch.1486644480" name="Arduino sketch" projectType="io.sloeber.core.sketch"/> | |||
| </storageModule> | |||
| <storageModule moduleId="scannerConfiguration"> | |||
| <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |||
| </storageModule> | |||
| <storageModule moduleId="refreshScope"/> | |||
| <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> | |||
| </cproject> | |||
| @@ -0,0 +1,65 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <projectDescription> | |||
| <name>LEDLamp</name> | |||
| <comment></comment> | |||
| <projects> | |||
| </projects> | |||
| <buildSpec> | |||
| <buildCommand> | |||
| <name>io.sloeber.core.inoToCpp</name> | |||
| <arguments> | |||
| </arguments> | |||
| </buildCommand> | |||
| <buildCommand> | |||
| <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | |||
| <triggers>clean,full,incremental,</triggers> | |||
| <arguments> | |||
| </arguments> | |||
| </buildCommand> | |||
| <buildCommand> | |||
| <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | |||
| <triggers>full,incremental,</triggers> | |||
| <arguments> | |||
| </arguments> | |||
| </buildCommand> | |||
| </buildSpec> | |||
| <natures> | |||
| <nature>org.eclipse.cdt.core.cnature</nature> | |||
| <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | |||
| <nature>org.eclipse.cdt.core.ccnature</nature> | |||
| <nature>io.sloeber.arduinonature</nature> | |||
| <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | |||
| </natures> | |||
| <linkedResources> | |||
| <link> | |||
| <name>core/core</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/cores/esp8266</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>core/variant</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/variants/d1</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/DNSServer</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/libraries/DNSServer</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/EEPROM</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/libraries/EEPROM</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/ESP8266WebServer</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/libraries/ESP8266WebServer</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/ESP8266WiFi</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/libraries/ESP8266WiFi</locationURI> | |||
| </link> | |||
| </linkedResources> | |||
| </projectDescription> | |||
| @@ -0,0 +1,11 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
| <project> | |||
| <configuration id="io.sloeber.core.sketch.0" name="Release"> | |||
| <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | |||
| <provider class="io.sloeber.core.toolchain.ArduinoLanguageProvider" console="false" env-hash="-201397279775688891" id="io.sloeber.languageSettingsProvider" keep-relative-paths="false" name="Arduino Compiler Settings" parameter="${COMMAND} -E -P -v -dD -D__IN_ECLIPSE__ "${INPUTS}"" prefer-non-shared="true"> | |||
| <language-scope id="org.eclipse.cdt.core.gcc"/> | |||
| <language-scope id="org.eclipse.cdt.core.g++"/> | |||
| </provider> | |||
| </extension> | |||
| </configuration> | |||
| </project> | |||
| @@ -0,0 +1,2 @@ | |||
| eclipse.preferences.version=1 | |||
| encoding/LEDLamp.ino=UTF-8 | |||
| @@ -0,0 +1,25 @@ | |||
| Config.Release.board.BOARD.ID=d1 | |||
| Config.Release.board.BOARD.MENU.baud=921600 | |||
| Config.Release.board.BOARD.MENU.dbg=Disabled | |||
| Config.Release.board.BOARD.MENU.eesz=4M2M | |||
| Config.Release.board.BOARD.MENU.exception=legacy | |||
| Config.Release.board.BOARD.MENU.ip=lm2f | |||
| Config.Release.board.BOARD.MENU.lvl=None____ | |||
| Config.Release.board.BOARD.MENU.ssl=all | |||
| Config.Release.board.BOARD.MENU.vt=flash | |||
| Config.Release.board.BOARD.MENU.wipe=all | |||
| Config.Release.board.BOARD.MENU.xtal=80 | |||
| Config.Release.board.BOARD.TXT=${SLOEBER_HOME}/arduinoPlugin/packages/esp8266/hardware/esp8266/2.6.0/boards.txt | |||
| Config.Release.board.PROGRAMMER.NAME=Default | |||
| Config.Release.board.UPLOAD.PORT=COM3 | |||
| Config.Release.compile.sloeber.extra.all= | |||
| Config.Release.compile.sloeber.extra.archive= | |||
| Config.Release.compile.sloeber.extra.assembly= | |||
| Config.Release.compile.sloeber.extra.c.compile= | |||
| Config.Release.compile.sloeber.extra.compile= | |||
| Config.Release.compile.sloeber.extra.cpp.compile= | |||
| Config.Release.compile.sloeber.extra.link= | |||
| Config.Release.compile.sloeber.size.switch=false | |||
| Config.Release.compile.sloeber.warning_level=NONE | |||
| Config.Release.compile.sloeber.warning_level.custom= | |||
| Config.Release.other.IS_VERSION_CONTROLLED=false | |||
| @@ -0,0 +1,316 @@ | |||
| #include "Arduino.h" | |||
| #include <ESP8266WiFi.h> | |||
| #include <ESP8266WebServer.h> | |||
| #include <EEPROM.h> | |||
| #include <DNSServer.h> | |||
| const int ledPin = LED_BUILTIN; // The built-in LED on the Wemos D1 Mini is on GPIO2 (D4) | |||
| ESP8266WebServer webServer(80); | |||
| WiFiServer server(1234); | |||
| DNSServer dnsServer; | |||
| const byte DNS_PORT = 53; | |||
| // AP Daten | |||
| const char *ap_ssid = "Wemos_Setup"; | |||
| const char *ap_pass = "admin123"; | |||
| // WLAN Config | |||
| struct Config { | |||
| char ssid[32]; | |||
| char pass[64]; | |||
| bool valid; | |||
| }; | |||
| Config config; | |||
| // ---------- EEPROM ---------- | |||
| void saveConfig() { | |||
| EEPROM.begin(sizeof(Config)); | |||
| EEPROM.put(0, config); | |||
| EEPROM.commit(); | |||
| } | |||
| void loadConfig() { | |||
| EEPROM.begin(sizeof(Config)); | |||
| EEPROM.get(0, config); | |||
| if (config.valid != true) { | |||
| config.valid = false; | |||
| } | |||
| } | |||
| // ---------- CAPTIVE PORTAL PAGE ---------- | |||
| void handleRoot() { | |||
| String mac = WiFi.macAddress(); | |||
| String html = | |||
| R"rawliteral( | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |||
| <title>Wemos Setup</title> | |||
| <style> | |||
| body { | |||
| margin: 0; | |||
| font-family: Arial, sans-serif; | |||
| background: linear-gradient(135deg, #1e1e2f, #2b5876); | |||
| color: white; | |||
| display: flex; | |||
| justify-content: center; | |||
| align-items: center; | |||
| height: 100vh; | |||
| } | |||
| * { | |||
| box-sizing: border-box; | |||
| } | |||
| .card { | |||
| background: rgba(255,255,255,0.08); | |||
| backdrop-filter: blur(10px); | |||
| padding: 25px; | |||
| border-radius: 16px; | |||
| width: 90%; | |||
| max-width: 360px; | |||
| box-shadow: 0 8px 20px rgba(0,0,0,0.3); | |||
| animation: fadeIn 0.8s ease; | |||
| } | |||
| h2 { | |||
| margin-top: 0; | |||
| text-align: center; | |||
| } | |||
| .info { | |||
| font-size: 12px; | |||
| opacity: 0.8; | |||
| margin-bottom: 15px; | |||
| text-align: center; | |||
| } | |||
| input { | |||
| width: 100%; | |||
| padding: 12px; | |||
| margin: 8px 0; | |||
| border-radius: 10px; | |||
| border: none; | |||
| outline: none; | |||
| font-size: 14px; | |||
| transition: 0.2s; | |||
| } | |||
| input:focus { | |||
| transform: scale(1.02); | |||
| } | |||
| button { | |||
| width: 100%; | |||
| padding: 12px; | |||
| margin-top: 10px; | |||
| border: none; | |||
| border-radius: 10px; | |||
| background: #00c6ff; | |||
| color: white; | |||
| font-size: 16px; | |||
| cursor: pointer; | |||
| transition: 0.3s; | |||
| } | |||
| button:hover { | |||
| background: #0072ff; | |||
| transform: translateY(-2px); | |||
| } | |||
| .mac { | |||
| font-size: 11px; | |||
| text-align: center; | |||
| margin-bottom: 15px; | |||
| opacity: 0.7; | |||
| word-break: break-all; | |||
| } | |||
| @keyframes fadeIn { | |||
| from {opacity: 0; transform: translateY(10px);} | |||
| to {opacity: 1; transform: translateY(0);} | |||
| } | |||
| </style> | |||
| </head> | |||
| <body> | |||
| <div class="card"> | |||
| <h2>Wemos Setup</h2> | |||
| <div class="mac">Device: )rawliteral" | |||
| + mac | |||
| + R"rawliteral(</div> | |||
| <form action="/save" method="POST"> | |||
| <input name="ssid" placeholder="WLAN Name (SSID)"> | |||
| <input name="pass" type="password" placeholder="Passwort"> | |||
| <button type="submit">Verbinden</button> | |||
| </form> | |||
| <div class="info"> | |||
| Verbinde deinen Wemos mit einem WLAN Netzwerk | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| )rawliteral"; | |||
| webServer.send(200, "text/html", html); | |||
| } | |||
| // ---------- SAVE ---------- | |||
| void handleSave() { | |||
| String ssid = webServer.arg("ssid"); | |||
| String pass = webServer.arg("pass"); | |||
| ssid.toCharArray(config.ssid, 32); | |||
| pass.toCharArray(config.pass, 64); | |||
| config.valid = true; | |||
| saveConfig(); | |||
| webServer.send(200, "text/html", "<h2>Gespeichert!</h2><p>Wemos startet neu...</p>"); | |||
| delay(1500); | |||
| ESP.restart(); | |||
| } | |||
| // ---------- NOT FOUND (CAPTIVE REDIRECT) ---------- | |||
| void handleNotFound() { | |||
| webServer.sendHeader("Location", "http://192.168.4.1/", true); | |||
| webServer.send(302, "text/plain", ""); | |||
| } | |||
| // ---------- START ACCESS POINT ---------- | |||
| void startAP() { | |||
| WiFi.mode(WIFI_AP); | |||
| WiFi.softAP(ap_ssid, ap_pass); | |||
| delay(500); | |||
| IPAddress apIP = WiFi.softAPIP(); | |||
| Serial.print("AP IP: "); | |||
| Serial.println(apIP); | |||
| // DNS: ALLE Domains auf ESP IP umleiten | |||
| dnsServer.start(DNS_PORT, "*", apIP); | |||
| // Webserver Routes | |||
| webServer.on("/", handleRoot); | |||
| webServer.on("/save", HTTP_POST, handleSave); | |||
| webServer.onNotFound(handleNotFound); | |||
| webServer.begin(); | |||
| Serial.println("Captive Portal gestartet"); | |||
| } | |||
| // ---------- CONNECT STA ---------- | |||
| bool connectSTA() { | |||
| WiFi.mode(WIFI_STA); | |||
| WiFi.begin(config.ssid, config.pass); | |||
| Serial.println(); | |||
| Serial.print("Verbinde mit WLAN: "); | |||
| Serial.println(config.ssid); | |||
| int tries = 0; | |||
| while (WiFi.status() != WL_CONNECTED && tries < 20) { | |||
| delay(500); | |||
| Serial.print("."); | |||
| tries++; | |||
| } | |||
| if (WiFi.status() == WL_CONNECTED) { | |||
| Serial.println(); | |||
| Serial.println("\nVerbunden!"); | |||
| Serial.print("IP: "); | |||
| Serial.println(WiFi.localIP()); | |||
| server.begin(); | |||
| Serial.println("TCP Server gestartet auf Port 1234"); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| // ---------- SETUP ---------- | |||
| void setup() { | |||
| Serial.begin(115200); | |||
| loadConfig(); | |||
| if (config.valid && connectSTA()) { | |||
| Serial.println("STA Mode aktiv"); | |||
| } else { | |||
| Serial.println(); | |||
| Serial.println(); | |||
| Serial.println("Starte Captive Portal"); | |||
| startAP(); | |||
| } | |||
| } | |||
| // ---------- LOOP ---------- | |||
| void loop() { | |||
| if (WiFi.getMode() == WIFI_AP) { | |||
| dnsServer.processNextRequest(); | |||
| webServer.handleClient(); | |||
| return; | |||
| } | |||
| webServer.handleClient(); // optional auch im STA Mode | |||
| WiFiClient client = server.available(); | |||
| if (!client) { | |||
| return; | |||
| } | |||
| Serial.println("Client verbunden"); | |||
| client.println("Connected"); | |||
| while (client.connected()) { | |||
| if (!client.available()) { | |||
| delay(1); | |||
| continue; | |||
| } | |||
| String msg = client.readStringUntil('\n'); | |||
| msg.trim(); | |||
| Serial.print("Empfangen: "); | |||
| Serial.println(msg); | |||
| client.println("ACK: " + msg); | |||
| if (msg.equalsIgnoreCase("/ledOn")) { | |||
| digitalWrite(ledPin, LOW); | |||
| } | |||
| if (msg.equalsIgnoreCase("/ledOff")) { | |||
| digitalWrite(ledPin, HIGH); | |||
| } | |||
| if (msg.equalsIgnoreCase("quit")) { | |||
| break; | |||
| } | |||
| } | |||
| client.stop(); | |||
| Serial.println("Client getrennt"); | |||
| } | |||
| @@ -0,0 +1,27 @@ | |||
| #ifdef __IN_ECLIPSE__ | |||
| //This is a automatic generated file | |||
| //Please do not modify this file | |||
| //If you touch this file your change will be overwritten during the next build | |||
| //This file has been generated on 2026-06-07 14:55:03 | |||
| #include "Arduino.h" | |||
| #include "Arduino.h" | |||
| #include <ESP8266WiFi.h> | |||
| #include <ESP8266WebServer.h> | |||
| #include <EEPROM.h> | |||
| #include <DNSServer.h> | |||
| void saveConfig() ; | |||
| void loadConfig() ; | |||
| void handleRoot() ; | |||
| void handleSave() ; | |||
| void handleNotFound() ; | |||
| void startAP() ; | |||
| bool connectSTA() ; | |||
| void setup() ; | |||
| void loop() ; | |||
| #include "LEDLamp.ino" | |||
| #endif | |||
| @@ -0,0 +1,2 @@ | |||
| spec.o: \ | |||
| D:/Work/Arduino/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.cpp | |||