1. Getting Started¶
Mu is a beginners-oriented python code editor that has been built with lots of feedback from teachers and learners throughout the time. A supported board on the Mu editor is the BBC microbit board for which we have created a tailored firmware (based on the MicroPython project) that includes the modules documented here. The BBC microbit in turn, gets plugged into the GiggleBot.
The following sections will direct you to setting up the GiggleBot firmware on the BBC microbit and thus be able to program it with the Mu editor. At the end of these short instructions, you will be able to run the following snippet of code that lights up the eye LEDs on the GiggleBot.
from microbit import *
from gigglebot import *
# initialize the neopixels on the GiggleBot
init()
while True:
set_eyes() # set GiggleBot eyes to blue (by default)
sleep(250) # wait 250 msec
pixels_off() # turn off the GiggleBot eyes
sleep(250) # wait 250 msec
1.1. Downloading the Firmware¶
The 1st option in downloading the firmware is to visit the direct link placed in here and download the afferent file. Make sure you download it as a hex
file.
The latest version (which is v0.4.0) of the firmware can also be directly downloaded from here.
The 2nd option is head over to this project’s release page and download the appropriate firmware for the appropriate documentation. As of this moment, this is the latest release.
1.2. Downloading the Modules¶
Apart from being able to download the firmware, the .py
and .mpy
modules can also be downloaded. And just like with the firmware,
you can either download the modules from the release page or by accessing the following direct links for version v0.4.0:
gigglebot.py, distance_sensor.py, thp.py, lightcolor.py,
gb_diag.py.
You can also check this artifact explorer here.
Important
Downloading the modules when the GiggleBot MicroPython Firmware is used is redundant. Use the modules (the py
modules) when you are using the basic
version of micropython. And in that case, not all py
modules will work - for that check this section and see how you can pair the modules to fit on a basic firmware.
1.3. Flashing the Firmware¶
Flashing the firmware is a breeze. Connect the BBC microbit to your laptop, wait until the MICROBIT filesystem appears and then copy-paste the GiggleBot firmware you just downloaded to the microbit.
After flashing the firmware, you will be able to import all modules listed in this documentation.
1.4. Custom Firmware in the Mu Editor¶
The Mu Editor comes with a default firmware for the microbit that can be overridden with the GiggleBot firmware instead. All that has to be done is to press on the gear wheel on the right hand side of the editor, then go to BBC micro:bit Settings and lastly, copy paste the path to the custom firmware (or runtime as the Mu editor likes to call).
1.5. Upgrading DAPLink Firmware¶
There may be cases when BBC microbit fails to flash the firmware when the binary is dragged and dropped. This is generally caused by an old version of the DAPLink firmware. This DAPLink firmware provides the USB interface that allows you to drag-and-drop binaries onto the target microcontroller (the microbit).
This DAPLink firmware can be easily upgraded. Just go over this short tutorial to upgrade it.