MantisIDE

Save power with deep sleep

Guide by MantisIDE Team · Fri Nov 27 2026 · 0 points · 0 comments

Do some work, then deep sleep for 10 seconds. The board restarts after waking and runs main.py again, so save this as main.py to try it.

A starter program from the MantisIDE Full IDE (Tools › Examples). Press Open in Full IDE to run it on your board, change it, and save it as your own.

# Do some work, then deep sleep for 10 seconds. The board restarts after waking
# and runs main.py again, so save this as main.py to try it.
import machine, time

print("Awake. Reset cause:", machine.reset_cause())
time.sleep(2)
print("Sleeping for 10 seconds…")
machine.deepsleep(10000)
Loading post…

Dialog