[GH-ISSUE #825] How to identify the status of the device #693

Open
opened 2026-02-28 01:26:36 +03:00 by kerem · 1 comment
Owner

Originally created by @anisvalarie on GitHub (Feb 15, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/825

Hey! First of all, congrats for the amazing library! You guys are making a very nice job here.

So, my question it's very simple. I'm already blinking a LED when the connection is lost and while the device is connecting. But I would like to blink slowly if the device is connecting (during the ConnectTimeout time) and blink faster if the config portal is available (during the ConfigPortalTimeout time). Which register can I use to identify the status of the device (trying to connect or on the config portal).

Sorry for the dumb question, but I didn't found the answer by myself.

Thanks!

Originally created by @anisvalarie on GitHub (Feb 15, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/825 Hey! First of all, congrats for the amazing library! You guys are making a very nice job here. So, my question it's very simple. I'm already blinking a LED when the connection is lost and while the device is connecting. But I would like to blink slowly if the device is connecting (during the ConnectTimeout time) and blink faster if the config portal is available (during the ConfigPortalTimeout time). Which register can I use to identify the status of the device (trying to connect or on the config portal). Sorry for the dumb question, but I didn't found the answer by myself. Thanks!
Author
Owner

@ljluestc commented on GitHub (Dec 27, 2023):

#include <WiFiManager.h>

#define LED_PIN 13  // Replace with the pin where your LED is connected
#define SLOW_BLINK_INTERVAL 1000  // 1 second interval
#define FAST_BLINK_INTERVAL 500   // 0.5 second interval

bool isConfigPortalActive = false;

void setup() {
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);

  // Your WiFiManager setup here
  WiFiManager wm;
  wm.setConfigPortalBlocking(false); // Non-blocking portal
  // ... (other WiFiManager settings)

  isConfigPortalActive = wm.startConfigPortal("myAP", "password"); // Start the configuration portal
}

void loop() {
  // Check if the device is connecting to WiFi
  if (WiFi.status() == WL_CONNECTING) {
    // Device is connecting, blink LED slowly
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(SLOW_BLINK_INTERVAL);
  } 
  // Check if the configuration portal is active
  else if (isConfigPortalActive) {
    // Configuration portal is active, blink LED faster
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(FAST_BLINK_INTERVAL);
  }

}

<!-- gh-comment-id:1870697636 --> @ljluestc commented on GitHub (Dec 27, 2023): ``` #include <WiFiManager.h> #define LED_PIN 13 // Replace with the pin where your LED is connected #define SLOW_BLINK_INTERVAL 1000 // 1 second interval #define FAST_BLINK_INTERVAL 500 // 0.5 second interval bool isConfigPortalActive = false; void setup() { pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LOW); // Your WiFiManager setup here WiFiManager wm; wm.setConfigPortalBlocking(false); // Non-blocking portal // ... (other WiFiManager settings) isConfigPortalActive = wm.startConfigPortal("myAP", "password"); // Start the configuration portal } void loop() { // Check if the device is connecting to WiFi if (WiFi.status() == WL_CONNECTING) { // Device is connecting, blink LED slowly digitalWrite(LED_PIN, !digitalRead(LED_PIN)); delay(SLOW_BLINK_INTERVAL); } // Check if the configuration portal is active else if (isConfigPortalActive) { // Configuration portal is active, blink LED faster digitalWrite(LED_PIN, !digitalRead(LED_PIN)); delay(FAST_BLINK_INTERVAL); } } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#693
No description provided.