I'm looking for a way to schedule tasks in micropython, for example read a sensor every 15 minutes, upload data every hour etc...
There are lots of methods to do this using various techniques however I can't find much info on how this can be done if you want to put the MCU to sleep in between task runs as deepsleep will usually results in losing state.
I was thinking of making a list of events in advance and then storing this in the RTC memory. When the MCU wakes it would pull the next task from the list, complete task and then determine how long it needs to go back to sleep for.
Does anyone have any better suggestions?
ESP32S2: Scheduling tasks with deepsleep
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Scheduling tasks with deepsleep
You haven't told us what hardware you're using. There is information on how to do this with Pyboards here but other platforms will vary greatly.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Scheduling tasks with deepsleep
Thanks Peter I'll have a look at that link.
I'm currently using an ESP32S2 chip, custom PCB.
I'm currently using an ESP32S2 chip, custom PCB.
pythoncoder wrote: ↑Mon Oct 25, 2021 7:15 amYou haven't told us what hardware you're using. There is information on how to do this with Pyboards here but other platforms will vary greatly.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ESP32S2: Scheduling tasks with deepsleep
I've no experience wit that chip. I've changed the title of your root message in the hope that someone will pop up who can help.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.