Double_G

WifiManager

Jun 3rd, 2020
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <WiFi.h>
  2. #include <WebServer.h>
  3. #include <DNSServer.h>
  4. #include <WiFiManager.h>
  5.  
  6.  
  7. #define TRIGGER_PIN 4
  8.  
  9.  
  10. void setup() {
  11. Serial.begin(115200);
  12. Serial.println("\n Starting");
  13. pinMode(TRIGGER_PIN, INPUT);
  14. }
  15.  
  16.  
  17. void loop() {
  18.  
  19. if ( digitalRead(TRIGGER_PIN) == LOW ) {
  20. WiFiManager wifiManager;
  21. if (!wifiManager.startConfigPortal("ESP32Wifi","12345678")) {
  22. Serial.println("failed to connect and hit timeout");
  23. delay(3000);
  24. ESP.reset();
  25. delay(5000);
  26. }
  27.  
  28. Serial.println("connected...yeey :)");
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment