Esp8266 ConnectSonoffDual mit optischer Anzeige als Arduino Tab.
ConnectSonoffDual.ino
// ****************************************************************
// Sketch Sonoff Dual Connect Modular(Tab) mit optischer Anzeige
// created: Jens Fleischer, 2018-06-16
// last mod: Jens Fleischer, 2018-06-16
// ****************************************************************
// Hardware: Sonoff Dual
// Getestet auf: Sonoff Dual
/******************************************************************
Copyright (c) 2018 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 Connect sollte als Tab eingebunden werden.
// #include <ESP8266WebServer.h> muss im Haupttab aufgerufen werden
// Die Funktionalität des ESP8266 Webservers ist erforderlich.
// Die Funktion "Connect();" muss im Setup eingebunden werden.
// Dieser Connect Tab ist speziell für das Sonoff Dual
/**************************************************************************************/
void Connect() { // Funktionsaufruf "Connect();" muss im Setup eingebunden werden
const char* ssid = "Netzwerkname"; // << kann bis zu 32 Zeichen haben
const char* password = "PasswortvomNetzwerk"; // << mindestens 8 Zeichen jedoch nicht länger als 64 Zeichen
const byte LEDPIN = 13; // Oneboard Led Sonoff Dual (blue)
//WiFi.disconnect(); // nur erforderlich wenn Esp den AP Modus nicht verlassen will
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
pinMode(LEDPIN, OUTPUT);
delay(50);
pinMode(LEDPIN, OUTPUT);
digitalWrite(LEDPIN, millis() % 500 >= 250);
if (millis() > 12000) ESP.restart();
}
digitalWrite(LEDPIN, 1);
}