RPi Pico W Humidity Controller

Hi! I am fairly new to the Anvil community, and I wanted to find out if there is a way to run a continuous loop on an RPi Pico W for humidity control that can be linked to an Anvil webpage.

I currently have an RPi Pico W running the standard Micropython firmware that I use to control a dehumidifier. It runs a continuous loop that every minute reads the temp/humidity, and then decides whether to turn the dehumidifier on or off.

I have also been playing with Anvil, and have a webpage where it will read and display the temperature/humidity of an RPi Pico W, and also an on/off button where I can turn a relay on or off. However, from what I can tell, the anvil.pico.connect(UPLINK_KEY) command is blocking. Is there a way to do a non-blocking call where this can be embedded inside of a continuous loop? I apologize if this has been answered before or if this is documented on the website.

Thanks!

Hi, and welcome to the Forum!

Thus far, I’ve only used the regular (non-Pico) Uplink, where the connection stays open after a connect call. I would expect the Pico version to stay connected, too, for at least some length of time, else the call would be pretty worthless. And the docs here

seem to agree. Are you frequently losing connections?