Arduino Uno WiFi status and WL_CONNECTED

I have the board connected via WiFi to home WiFi AP. The WiFi connects find and operates fine.

Before Calling: status = WiFi.begin(ssid, pass);

21:59:05.251 -> WiFi Firmware OK!
21:59:05.283 -> Attempting to connect to WPA SSID: MyNetwork
21:59:05.346 -> status, WL_CONNECTED:    0:3

Status is 0 and WL_CONNECTED is 3.

After calling status = WiFi.begin(ssid, pass); and it has connected
22:00:07.315 -> status, WL_CONNECTED: 3:3

Randomly the the WiFi AP will power off. It is in fact shared internet through Microsoft Mobile Hot spot (some AP thing that comes with windows). Every time there is windows update it reboots and the AP does not come back on automatically.

I do a HTTPS POST to a web server of mine every hour from the Arduino.

Before calling the HTTPs Post funtion I do a check if:

if ( status == WL_CONNECTED )

The issue is that status or WL_CONNECTED never changes. Even if the AP is off they both always remain 3.

My HTTPs Post function will then continue and try to POST to an endpoint where it will fail gracefully through a handled error but thinking the Endpoint is unreachable not that the AP is down.

My question is how can I check this condition if status and WL_CONNECTED always remain 3.

Am i missing something fundamental here ?

Thank you in advance for your help.

yes your are missing very fundamental things.
WL_CONNECTED is a constant. a name for the value 3. it can't change.
status is a variable which holds the value set to it. it will not change unless you assign a new value to it. it would make sense to assign current result of WiFi.status() to it or just compare WiFi.status() with WL_CONNECTED

Thanks. Yep all fixed now just a silly error on my side. I didn't see 'WiFi.status() '.

To any others who may have followed the example code I used just make sure that before you use the network/WiFi int status = WiFi.status(); or as Juraj said use WiFi.status(); directly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.