Closed
Description
The main way for CLI/Desktop tools/editors to interact with MicroPython is via serial REPL. When the board is asleep, it will stop responding to serial, so with a programme like this one, the only option is to reflash the micro:bit with MicroPython, as it won't respond to most tools or desktop editors from serial anymore:
import power
power.deep_sleep()
At the time of writing, due to issue #126, the programme above won't go to sleep, but to replicate we can simply add Button A as the only wake up source:
from microbit import *
import power
while True:
power.deep_sleep(wake_on=button_a)
display.show(Image.SURPRISED)
sleep(500)
While this could be obvious for a small programme that basically sleeps, the same can be trigger with other "normal" programmes that might go to sleep for any amount of time, like with data logging.
Should the board wake up via serial?
If the answer is "yes", it could be:
- implicitly configured and unchangeable
- a new parameter with a default value, e.g.
power.deep_sleep(serial_wake=True)
- another argument option for the
wake_on
parameter, i.e.power.deep_sleep(wake_on=(pin1, serial))
- Should in this case the default be
power.deep_sleep(wake_on=serial)
?
- Should in this case the default be
Metadata
Metadata
Assignees
Labels
No labels