Replies: 1 comment
-
The theory of what you are saying is correct, but microdot does not have a "loop" in which you can add this. The loop in question is actually the asyncio loop. There are a couple of discussions on the topic, but nothing has been done to my knowledge:
You may also need to take some measurements to determine how much power is consumed by the lights and by the web server separately. Not clear from your description of the problem that you have done this, but this is important to determine if optimizing the web server is going to having significant impact or not. |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Hi there! I'm still learning about MicroPython/Python and microcontrollers. I am looking to integrate the Pi Pico W into things that are typically battery powered and need to manually be turned on/off via a hardware switch. I want to use the Pico W to allow me to turn these items on/off as necessary.
I have a small (like 12" tall) plastic light-up ghost decoration for Halloween. I made a not-so-pretty hole on the bottom, soldered wires to the battery terminals, and connected them to a Pico W. Then I connected 2 AA batteries, which from what I understand can supply roughly 1500-2500mAh each. Microdot is used to run the server and accept requests to turn it on/off.
The decoration lasted maybe 2ish days (decoration lights were off during the day obviously). Ideally I'd like to get small decorations like this to last about a week on a single charge.
What can I do to improve this? I understand MQTT is an option, but I'd rather use HTTP via Microdot if possible.
I've read about MicroPython's
machine.idle
,sleep
, etc. But how would I apply that to Microdot? It looks like the idle function would need to go in the loop in the source code thatapp.run()
creates. Am I right in thinking this?Beta Was this translation helpful? Give feedback.
All reactions