This programme is meant to go to sleep right away and stay asleep until any of the "hidden" wake up sources (serial or USB insertion) wake it up.
from microbit import *
import power
@run_every(s=1)
def print_time():
sleep(100)
display.show([Image.HEART, Image.HEART_SMALL])
power.deep_sleep(run_every=False)
while True:
display.show(Image.SURPRISED)
sleep(500)
It seems to work fine when connected to my computer via USB, but on battery power, if you press the reset button enough times it will eventually not stay asleep and show the SURPRISED face and the run_every beating heart.
Interestingly, I haven't been able to replicate this if I remove the run_every function, or any of the two statements inside, but it might be that I haven't tried hard enough.
I'll see if I can replicate in CODAL, but logging here first in case it's something on the MicroPython side.
This programme is meant to go to sleep right away and stay asleep until any of the "hidden" wake up sources (serial or USB insertion) wake it up.
It seems to work fine when connected to my computer via USB, but on battery power, if you press the reset button enough times it will eventually not stay asleep and show the SURPRISED face and the
run_every
beating heart.Interestingly, I haven't been able to replicate this if I remove the
run_every
function, or any of the two statements inside, but it might be that I haven't tried hard enough.I'll see if I can replicate in CODAL, but logging here first in case it's something on the MicroPython side.