PICO-W Background Wi-Fi Connection using beginNoBlock
/If you’ve ever wanted to keep your lights flickering while your PICO-W connects to Wi-Fi this post is for you. For anyone else, just enjoy the picture.
The problem I had was that the WiFi.begin method in the Raspberry Pi PICO-W Arduino framework is blocking. In other words, when I call the method to connect to Wi-Fi execution returns after the connection has been made, blocking any other calls. And my lights stop flickering. Which is I don’t like.
I spent lot of time with ChatGPT trying to write an asynchronous version of the begin method for PICO. I learned a lot and I was on the point of getting something working (probably) when I noticed a little method called beginNoBlock hidden in the PICO Wi-Fi library. Turns out that this does exactly what I want. All I had to do was call this method instead of begin and it all just worked. I’ve added this to the latest release of the framework at https://github.com/connected-little-boxes/HullOS-Z