this post was submitted on 24 Jan 2024
568 points (97.3% liked)
Programmer Humor
19503 readers
1248 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
On microcontrollers that might be a valid approach.
I've written these cycle-perfect sleep loops before.
It gets really complicated if you want to account for time spent in interrupt handlers.
Thankfully I didn't need high precision realtime. I just needed to wait a few seconds for serial comm.
But then I gotta buy a space heater too...
Microcontrollers run 100% of the time even while sleeping.
Nah, some MCUs have low power modes.
ESP32 has 5 of them, from disabling fancy features, throttling the clock, even delegating to an ultra low power coprocessor, or just going to sleep until a pin wakes it up again. It can go from 240mA to 150uA and still process things, or sleep for only 5uA.
Nah, Sleeping != Low power mode. The now obsolete ATmega328 has a low power mode.