Question Pico W - Multi-tasking through Web Interface

Aug 30, 2022
16
0
10
I have created a micropython program ("Relay Program") to run an event (turn on a relay) for a set time period (say 5 seconds) at a certain time every day. I would like to be able to change the the time period to affect the amount of time the relay is on as necessary. I have created a "Web Interface Program" that allows me to get a user-entered value and write it to a file on the Pico W. My thinking is that the "Relay Program" will read this file, get the value and use it as the time period for the relay. I'm not sure of the best way to get the two programs running at the same time or is there a way to have the While loop in the "Relay Program" also "listen" for user input. The Pico W is running standalone.

Hopefully I have written out my scenario well enough for folk to be able to offer suggestions, but please let me know if I need to provide additional info.
 

OldSurferDude

Reputable
May 18, 2019
171
31
4,640
Welcome to the world of Home Automation.

Yeah, your technique will work just fine and I suggest you go with it. KISS (keep it simple, stupid!)

There are a myriad of ways to do your task. The problem is that once you get that automated, then you'll think of something else to automate. And then something else ... and your hooked. Look into the home automation. Open Hab, Home Assistant, MySensors. And you'll want to learn about MQTT which is a software short message delivery system. All of this is open source.

Have fun

OSD