So a programme like this one, which purposely turns off the run_every events during sleep, will wake up and run the print_time() function 5 times in a row:
from microbit import *
import power
@run_every(s=3)
def print_time():
print(running_time())
display.show([Image.HEART, Image.HEART_SMALL])
while True:
power.deep_sleep(15_000, run_every=False)
The heart animation can be seen 5 times, and this is printed to serial:
15182
15985
16789
17593
18397
I think in the occasions when deep_sleep is set up with run_every=False, we wouldn't expect the events to still be queued and all of them run when it wakes up, as the board might be put to sleep for long periods of time (for example, a data logging app that is meant to be deployed somewhere and start/stop logging when a button is pressed).
So a programme like this one, which purposely turns off the
run_every
events during sleep, will wake up and run theprint_time()
function 5 times in a row:The heart animation can be seen 5 times, and this is printed to serial:
I think in the occasions when
deep_sleep
is set up withrun_every=False
, we wouldn't expect the events to still be queued and all of them run when it wakes up, as the board might be put to sleep for long periods of time (for example, a data logging app that is meant to be deployed somewhere and start/stop logging when a button is pressed).