Awesome
BBC micro:bit Cutebot MicroPython library
Library providing functions to work with Cutebot kit for BBC micro:bit board in Python language.
Prerequisites
Usage
See python docstrings in cutebot.py
for description of available functions.
There are several methods how to flash your Python program to micro:bit board.
Some of these methods are described below. All of them has been tested recently.
After these steps you will be able to import the cutebot library like any other python module.
import cutebot
# or
from cutebot import *
There is always possibility to simply copy content of the cutebot.py
above your Python code without importing the module.
It will work, however this way is not recommended.
Micro:bit is designed to help people learn to program so do not learn bad practices.
Online editor
No additional tools are required. Just a web browser of your choice.
- Connect you micro:bit board to you PC using USB cable
- Click the
Load/Save
button - Add
cutebot.py
to project files - Write your code in editor
- Click the
Connect
button, then click theFlash
button (in Chromium based browsers) OR download the hex file and copy it to your micro:bit.
Mu editor (best for beginners)
Simple Python editor. This method looks similar to the previous one but this editor is available offline.
Prerequisites:
- Connect you micro:bit board to you PC using USB cable
- Start Mu editor in micro:bit mode
- Copy
cutebot.py
tomu_code
folder in your home directory (after that it will be listed inFiles
) - Click the
Files
button - Drag and drop
cutebot.py
in the left box - Write your code in editor
- Click the
Flash
button
CLI (for advanced users, suitable for scripts)
Prerequisites:
These are the same command line tools the Mu editor uses in background.
- Connect you micro:bit board to you PC using USB cable
- Flash MicroPython interpreter to you board using
uflash
command - Upload cutebot.py to you micro:bit using microfs
ufs put cutebot.py
- Upload you program (the name
main.py
is required)ufs put main.py
Please note that every use of uflash
or copying a new hex file will clear the board's storage
so your .py files copied with ufs
will be deleted.
See also
- micro:bit MicroPython documentation
examples/
folder for python implementation of official examples (not all of them are ready yet).- My micro:bit bakefile repo
- Difference between uploading a hex file with program and a
main.py
using microfs