AutoConnectNonBlocking.ino 758 B

123456789101112131415161718192021222324252627
  1. #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
  2. WiFiManager wm;
  3. void setup() {
  4. WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
  5. // put your setup code here, to run once:
  6. Serial.begin(115200);
  7. //reset settings - wipe credentials for testing
  8. //wm.resetSettings();
  9. wm.setConfigPortalBlocking(false);
  10. //automatically connect using saved credentials if they exist
  11. //If connection fails it starts an access point with the specified name
  12. if(wm.autoConnect("AutoConnectAP")){
  13. Serial.println("connected...yeey :)");
  14. }
  15. else {
  16. Serial.println("Configportal running");
  17. }
  18. }
  19. void loop() {
  20. wm.process();
  21. // put your main code here, to run repeatedly:
  22. }