Programs for the Electronics Starter Kit for micro:bit

Block Code

Click on the program in the list below to open it ready to install it on your micro:bit. If you are looking for the MicroPython versions of the programs, you can find them on GitHub here.

welcome

 

P1 Alarm

 

P2 Lighthouse

 

P3 Shoutometer

 

P4 Thermometer (Centigrade)

If you have an older version of the kit, you will notice that the code here has been improved slightly from that shown in the booklet. The change is to make it easier to calibrate your sensor as described below.

 

P4 THERMOMETER (Fahrenheit)

 

Temperature Calibration

If you want to make your thermometer more accurate, this section will show you how to calibrate it.

To calculate the temperature whether in degrees F or C, the analog reading is first multiplied by a number (A) the result is then divided by another number (B) and then a positive or negative final number C is added to the result. To make your thermometer more accurate you can use the program P4 Calibrate to find the analog reading for two known temperatures (using a second thermometer) and then calculate new values of A, B and C.

Step 1. Flash the program P4 Calibrate onto your micro:bit with the Sensor Board wired up as described above.

Step 2. Record the temperature (either in F or C) using a second thermometer placed close to the temperature sensor on the board. Then press button A and record the value displayed. You can write both these values in the table below as I have here, where the temperature in C was recoded as 18 degrees and the sensor reading 460.

Step 3. Wrap an ice cube in a plastic bag and hold it against both the temperature sensor on the Sensor Board and the second thermometer at the same time. Wait for 30 seconds and then record both the second thermometer reading and the reading displayed by the micro:bit (when you press button A). In this case the readings were 0 degrees C and 345. Write them in the table too.

Step 4. Calculate A, B and C using the formulas in the table:

Room temperature using thermometer (t1)

18

Room temperature reading on Sensor (r1)

460

Cold temperature using thermometer (t2)

0

Cold temperature reading on Sensor (r2)

345

A = t1 – t2

18

B = r1 – r2

115

C = t2 – (A / B) * r2

0 – (18/115) * 345 = -54

Once you have the values of A, B and C, you can change these value in your block program.

P5 Fan Speed Controller

 

P6 Automatic Fan (Centigrade)

If you have an older version of the kit, you will notice that the code here has been improved slightly from that shown in the booklet. The change is to make it easier to calibrate your sensor as described below.

 

P6 AUTOMATIC FAN (Fahrenheit)

 

P7 Magic Music