Deep Sleep with MicroPython
-
Hi, I'd like to press the M5 button on my M5StickC-Plus, do something, turn it off/deep sleep and turn it back on with the 'M5' button, as it is easily accessible. Basically I think this is how one of those Dash buttons used to work.
I tried with:
axp.setLDO2State(False) axp.setLDO3State(False)The screen turns off, but the device seems very much alive (I tried issuing commands from the REPL) and, when unplugged, completely discharges in a short period of time (maybe a few hours?)
Is there a way to do this? I saw there may be something for Arduino, not sure if it works reliably, but I'd be willing to port my code to Arduino to have this functionality.
-
Hello @koichirose
here is how I managed to get M5StickC Plus into deep sleep using MicroPython:
p37 = machine.Pin(37, mode = machine.Pin.IN, pull = machine.Pin.PULL_UP) p37.irq(trigger = machine.Pin.WAKE_LOW, wake = machine.DEEPSLEEP) machine.deepsleep(20000)It wakes up from deep sleep either after 20 seconds or when button A is pressed.
Thanks
Felix
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login