WiFi.listening() not working? [SOLVED]

Hi All,

I using the spark core and am having trouble with WiFi.listening(). Here’s what I’m doing:
If the user pulls a pin high (via a button) during the setup() function, then the program calls WiFi.listen(). This works fine and I can see from the spark’s led that the board is in listening mode. However, I’d like to indicate this on an LED strip so I have code like this:

while(WiFi.listening()) {

My program seems to skip the led_strip_code() and blocks at the Spark.connect() until new credentials are given. Anyone have ideas as to why I can’t run the led_strip_code()? BTW, I’m in SEMI_AUTOMATIC mode.

thanks in advance

What code is written in your led_strip_code function? Also take a look here to see a recent discussion about the Spark.connect() being a blocked/non-blocked call…

Ah ha! Here is my answer: https://community.spark.io/t/can-you-turn-off-wifi-listen-once-it-starts-and-what-is-the-purpose-of-wifi-listening-solved/10051/6?u=matt_ri

WiFi.listen() is blocking to loop() but one could still call WiFi.listening() in an ISR.

It would be great if all functions that are blocking had that info in the docs :slight_smile:

1 Like