microrepl
microrepl copied to clipboard
Support Raspberry Pi
Current status: urepl
fails to open on Raspberry Pi.
ImportError: cannot import name comports
I'll do some more digging and post my findings here.
Ok by installing the latest version of Serial I seem to have got it working.
I uninstalled the apt packages for Serial for py2 & py3:
sudo apt-get purge python-serial python3-serial -y
And installed the latest serial from PyPI:
sudo pip install pyserial --upgrade
sudo pip3 install pyserial --upgrade
I thought it would be harder than that but ok.
I will pass this on to my team and get it packaged for Raspbian.
On a related note, how do you reset the microbit? I have one running some code created using the web interface, I think, and I can't connect to it using urepl
. Is there a method of reflashing it?
Hi @bennuttall great stuff!
The only thing urepl brings to the party is that it auto-discovers the correct USB-serial port for the micro:bit. You could just use a "regular" tool like picocom (see the bottom of the README here: https://github.com/bbcmicrobit/micropython).
In terms of re-flashing the device, try this file as a very recent build from master with "vanilla" MicroPython (i.e. no Python script automatically installed with it).
https://github.com/ntoll/upyed/raw/master/firmware.hex
Give me a couple of days and we'll have this working in "mu". ;-)
Great - thanks. I'm keen to write code in Python on the Pi that can talk to the microbit but also do regular Python stuff like GPIO and requests! I'll have a play
Agh I'm giving this another try and failing to get it running again.
@ntoll Can you give it a try and let me know how you get on?
On a Pi, I mean
Will do.
Here's how to make it work:
git clone https://github.com/ntoll/microrepl.git
cd microrepl
sudo apt-get install python3-serial
python3 microrepl.py
However, I suggest this tool if not used - rather it's better to use, say, picocom like this:
sudo apt-get install picocom
picocom /dev/ttyACM0 -b 115200
Or even better, just use the REPL built into Mu.