Skip to content
Code for my book "micro:bit for the Mad Scientist"
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
other downloads
python rename ch2 Mar 25, 2019
LICENSE Initial commit Jun 6, 2018 Update Jul 4, 2019

micro:bit for the Mad Scientist

Code for my book "micro:bit for the Mad Scientist"

Some of the programs in this book get pretty long and complex, and typing them in is not something that the Mad Scientist in you is likely to be keen to do.

All the Block code is published on the makecode website and shared by a short URL that will open your own copy of the Block code project in your browser. Here are the short URLs for the book's projects and experiments. Just click on them to open the project. Once the project is open, you can click on Download to create the HEX file that then needs to be dragged onto your micro:bit. If you feel like editing the Block code to try your own ideas out, then click on the Edit button.


Chapter 2

Musical Doorbell


Chapter 3

Automatic Night-Light

Light Guitar

Magic Mirror

Chapter 4


Magnetic Alarm

Chapter 5

Toothbrushing Monitor

Acceleration Display

Chapter 6 and 7 don't have any Blocks code

Chapter 8

Lie Detector

Chapter 9

Plant Waterer

Chapter 10

Wireless Doorbell


Rover Controller


Chapter 2

Experiment 1: Generating Sounds

There is no block code for Experiment 2

Chapter 3

Experiment 3: Sensing Light

Chapter 4

Experiment 4: Magnetic Fields

[Link for Google Sheet spreadsheet for Experiment 4)(

Chapter 5

Experiment 5: Gestures

There is no block code for Experiments 6 and 7

Chapter 6

Experiment 8: Servomotors

There is no block code for experiments 7 to 12.

Chapter 10

Experiment 12: Radio Range

Cloning and Downloading

If you are an expert developer, used to using git, then you can clone the entire project into your computer. However, if you just want to get the Python code, you can download it as a ZIP file. To do this, click on the green Clone or download button and select Download ZIP.

Copying the Downloaded MicroPython Files

Find the ZIP file ( in your downloads area and then extract all the files from it. This will create a directory called 'mbms-master'. Within this directory you will find another directory called 'python' and within this, you will find all of the MicroPython programs for the book as a separate file, each with the extension .py.

Unfortunately Mu is not associated with the file type of .py, so to make it super easy to find the programs for the book when using Mu, I suggest that you copy all the MicroPython programs from the download into the directory where Mu normally expects to find its programs. By default this is a directory called mu_code within your home directory.

Other Downloads

You may also have noticed that there is a directory here called 'other downloads'. This directory contains other files for projects, such as drawing templates.

You can’t perform that action at this time.