Name: micropython
Owner: Open Roberta
Description: Port of MicroPython for the BBC micro:bit
Forked from: bbcmicrobit/micropython
Created: 2016-10-22 16:57:04.0
Updated: 2016-10-22 16:57:06.0
Pushed: 2016-10-22 15:10:51.0
Size: 22351
Language: C
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is the source code for MicroPython running on the BBC micro:bit!
To get involved with the community subscribe to the microbit@python.org mailing list (https://mail.python.org/mailman/listinfo/microbit). You need to be a member to post messages.
Various things are in this repository, including:
The source code is a yotta application and needs yotta to build, along with an ARM compiler toolchain (eg arm-none-eabi-gcc and friends).
Ubuntu users can install the needed packages using:
add-apt-repository -y ppa:team-gcc-arm-embedded
add-apt-repository -y ppa:pmiller-opensource/ppa
apt-get update
apt-get install cmake ninja-build gcc-arm-none-eabi srecord libssl-dev
install yotta
Once all packages are installed, use yotta to build. You will need an ARM mbed account to complete the first command, and will be prompted to create one as a part of the process.
Use target bbc-microbit-classic-gcc-nosd:
arget bbc-microbit-classic-gcc-nosd
Run yotta update to fetch remote assets:
p
Start the build:
uild
The resulting microbit-micropython.hex file to flash onto the device can be found in the build/bbc-microbit-classic-gcc-nosd/source from the root of the repository.
There is a Makefile provided that does some extra preprocessing of the source, which is needed only if you add new interned strings to qstrdefsport.h. The Makefile also puts the resulting firmware at build/firmware.hex, and includes some convenience targets.
Upon reset you will have a REPL on the USB CDC serial port, with baudrate 115200 (eg picocom /dev/ttyACM0 -b 115200).
Then try:
>>> import microbit
>>> microbit.display.scroll('hello!')
>>> microbit.button_a.is_pressed()
>>> dir(microbit)
Tab completion works and is very useful!
Read our documentation here:
https://microbit-micropython.readthedocs.io/en/latest/
You can also use the tools/pyboard.py script to run Python scripts directly from your PC, eg:
$ ./tools/pyboard.py /dev/ttyACM0 examples/conway.py
Be brave! Break things! Learn and have fun!