Have to reset Microbit after each 'run'
martinohanlon opened this issue · 1 comments
martinohanlon commented
When I was testing, I quite often received the error:
Traceback (most recent call last):
File "C:\Users\marti\Desktop\AdventuresInMinecraft-PC\MyAdventures\button.py", line 2, in <module>
import microbit
File "C:\Users\marti\Desktop\AdventuresInMinecraft-PC\MyAdventures\microbit\__init__.py", line 93, in <module>
repl.to_raw()
File "C:\Users\marti\Desktop\AdventuresInMinecraft-PC\MyAdventures\microbit\repl\repl.py", line 104, in to_raw
raise REPLException("could not get a prompt")
microbit.repl.repl.REPLException: could not get a prompt
To reproduce the error, I needed to do this:
- run the button.py test program, which runs successfully
- Ctrl C to exit
- run the button.py test program again, which fails with the error above
To get the microbit to respond again, I had to reset it, either by using the button on the back or by disconnecting and reconnecting it.
whaleygeek commented
Fixed in 48dfc14
When the program exits, the micro:bit does not reset, so it is left at the Raw REPL prompt. Running it again causes the startup state machine to get confused.
I added an extra CTRL-B into the startup state machine, so that it will exit the raw REPL if it is running. I tested this on Mac and it seems to work fine.