Learn to program‎ > ‎

BBC micro:bit

Getting started

To get started, plug your Micro:bit into an available USB port and choose your preferred programming environment depending on how confident you are with your coding ability (loosely linked to your age) ...

https://makecode.microbit.org/# https://makecode.microbit.org/# http://python.microbit.org/v/1
With both these editors, you have to download the micro:bit 'hex' file and transfer it manually to your micro:bit by dragging it onto the micro:bit drive. I would spend a little time reading through the help documentation and familiarising yourself with the available commands - better to know what you don't know than not to know, no?

https://makecode.microbit.org/reference https://makecode.microbit.org/javascript http://microbit-micropython.readthedocs.io/en/latest/
Click the relevant bubble to get more help!

Code with Micropython using the 'Mu' editor - best option for confident programmers.

The Mu editor has all the features of the standard Python editor but it allows you to flash your script directly onto the micro:bit and also has a 'REPL' (Read, Evaluate, Print, Loop) which allows you to run code directly on the device without flashing a script onto it - great for testing!

https://drive.google.com/file/d/1_Z2bWZCWOnMc94Gx7aj1dkagVOq8eu4k/preview
The Mu Editor - Click to engage
  • On windows, install 'mu' from Code with mu website.
  • You will also need to install the Mbed ARM driver to be able to access the REPL (Read, Evaluate, Print, Loop). Mu uses this serial port driver to communicate directly with the micro:bit using a terminal emulator to run Micropython which means that you won't be able to use the REPL (or Mu for that matter) if you are using serial communication with your micro:bit.
  • Start with the tutorials on the official Micropython for Microbit documentation
  • Download a copy of the Micropython Cheat Sheet for your desktop and the Speech reference (both these documents taken directly from the official Micropython documentation but summarised for easier reference).
  • You can also buy the official Micropython pyboard if you wish.

Physical computing

The BBC Micro:bit was designed primarily for physical computing - that's why it has an edge connector. For lots of the projects, you will need some physical devices to connect to your Micro:bit. If you are lucky enough to be able to buy them, these are good ones to start with ...

Kitronik Inventor Kit for BBC micro:bit (full range of accessories here)

Grok Learning

If you are lucky enough to have a Grok Learning subscription, there are lots of courses available for the micro:bit.

Investigations / lessons

The BBC micro:bit ships with various hardware. First, let's investigate that.

Display

Show an icon
Design an image
Set / unset a pixel
Animation

Button presses
Where we learn how to use the hardware buttons and the LED display.

The micro:bit as two hardware buttons on the front - button A and button B. You can program the micro:bit to do different things when the buttons are pressed.

BL / JS / PY : On the press of Button A, show a picture of a smiley face on the LED display. Use one of the built in icons or create your own if you want.
BL / JS / PY : Now extend your script to show a sad face when you press Button B.
BL / JS / PY : Finally, display a confused face when you press button A and button B together.

(microbit-button-a-happy)
(microbit-button-a-happy-b-sad)
(microbit-button-a-happy-b-sad-both-confused)

Pin touches
Where we learn how to recognise pin touches and how to use variables.

The micro:bit has 25 pins on the 'edge connector' which you can use to connect to external devices. The large pins (or pads) are useful for connecting crocodile clips to or will respond when you touch them. You will have to touch the 'GND' pin at the same time for the micro:bit to detect the touch.

BL / JS / PY : Write a script which displays a number 0, 1 or 2 depending on which of the large pins / pads you touch on the edge connector of the microbit.
BL / JS / PY : The number stays on the display. Extend your script so that the micro:bit clears the display after 1s.
BL / JS / PY : Using three separate variables, pin_0, pin_1 and pin_2, keep track of how many touches each pin has had and display the number of touches on the display rather than the pin number you touched.

(microbit-pin-touch)
(microbit-pin-touch-clear)
(microbit-pin-touch-variables)

Thermometer
Where we learn how to access the built in thermometer and how to plot graphs on the LED display.

The thermometer is built into the micro:bit processor - you can touch the processor to affect the temperature reading but make sure that you have 'grounded' yourself first in case you are charged up with static.

BL / PY : Design a thermometer that displays the temperature in digits on the display when you shake you micro:bit. 
BL / PY : Now change so that the micro:bit plots a graph of the temperature up to 50°C. The micro:bit should pause with the graph on the screen for 1s (1000ms) before clearing the screen. (You could try this with micropython but you will need to create a series of images for the graph and generate the graph manually - I don't *think* that micropython supports plotbargraph method in its led library).

(microbit-temperature-on-shake)
(microbit-temperature-on-shake-graph)

Extension : Try outputting the temperature to the serial port so you can monitor the reading live using the simulator, REPL in Mu or a terminal window using Putty. You can either use the 'serial' blocks in the Block and Javascript editor or simply 'print' the temperature reading using micropython.

Compass
Where we learn how to access the compass, join strings together, use selection to make choices and stand in a field.

The built in compass uses the Earths magnetic field to work out which direction the micro:bit is pointing. You will probably have to calibrate the compass before your scripts will run - follow the instructions on the screen.

BL / JS / PY : Create a simple script which displays the compass heading, H, as 'Heading : H' scrolling on the display. You will have to use the 'join' block from the 'text' section.
BL / JS / PY : The display doesn't really respond quick enough to changes in heading because the scrolling message locks up the micro:bit until it finishes. Adapt your script so that it displays 'N', 'S', 'E' or 'W' based on the direction (in degrees) the micro:bit is facing. (HINT : There are two situations where the micro:bit should display 'N'). You might want to introduce a slight pause after the micro:bit displays the heading to stop the display flashing. You will probably also find that the simulator works perfectly but your micro:bit goes a bit crazy. This is because of local magnetic fields - connect your battery pack and take your micro:bit out into a field to see it working properly.
BL / JS / PY : Get some variables in there! You will notice that the 'compass.heading' block appears 5 times in the last script meaning that the sensor will be 'polled' 5 times during each cycle of the forever loop. Adapt your scripts so that they use a single variable, 'heading', which is set at the start of the loop and then used in the comparison statements.

(microbit-compass-heading)
(microbit-compass-heading-letter)
(microbit-compass-heading-letter-variable)

Extension : Try outputting the compass heading to the serial port so you can monitor the reading live using the simulator, REPL in Mu or a terminal window using Putty. You can either use the 'serial' blocks in the Block and Javascript editor or simply 'print' the compass heading using micropython.

Accelerometer

As well as registering 'gestures', the micro:bits accelerometer will also measure accurately the position of the device in three dimensions (in milligravities, mg), along the x-axis (tilt left and right), along the y-axis (tilt forward and backward) and along the z-axis (face up or face down). The limits of the values for the accelerometer in either axis are -2048mg to +2048mg, although this range can be changed. Accelerometers are used in mobile phones to detect screen orientation (portrait / landscape) and to control games by tilting the phone.

https://drive.google.com/file/d/1ylsYZek3gR4lKLIRPHuMPd6C9PK38SIO/preview
Click to engage, though it's a bit complicated

BL / JS / PY : The easiest way to see this in action is to draw a graph (up to 1023) of the accelerometer reading. Create a simple script which plots a graph of the 'x' accelerometer reading. NOTE : The graphing function cannot show negative numbers so -1023 looks the same as +1023. The best way to see the actual readings is to use Putty to monitor the serial port of the micro:bit which will show the actual accelerometer reading.
BL / JS / PY : Now make similar scripts which detect the movement in the 'y' and the 'z' direction.
BL / JS / PY : Finally, make a script which can be used to change the axis which is being monitored using the hardware buttons - press button A to monitor 'x', button B to monitor 'y' and both button to monitor 'z'.
BL / JS / PY : Create a script which monitors the accelerometer strength using a graph (up to 2048). Again, you can monitor the actual accelerometer reading using Putty.

(microbit-accelerometer-x-graph)
(microbit-accelerometer-y-graph)
(microbit-accelerometer-z-graph)
(microbit-accelerometer-x-y-z-graph-buttons)
(microbit-accelerometer-strength-graph)

Free-fall sensor

The accelerometer can also be used to detect if the micro:bit has been dropped - the gesture is called 'freefall'. Accelerometers are built into mechanical hard drives to detect if the drive (or device containing the drive) has been dropped and park the drive head to prevent damage. The accelerometer monitors the strength of the acceleration due to gravity on the device and if it fall quickly below a threshold (about 500mg), freefall is triggered.

TAKE CARE : To trigger 'freefall', you will have to drop your micro:bit. Make sure that you have a long USB cable and that there is something to catch the device like a cushion or a coat. Don't just drop your micro:bit!

BL / JS / PY : Develop a simple script which allows you to detect whether the micro:bit has entered freefall. Because it's difficult to see the display, you are better outputting a message to the serial port and monitor this with Mu or Putty.
BL / JS / PY : Use the join text block to add the accelerometer strength reading to the message which displays to the terminal when freefall is detected. You should see that the accelerometer strength is below 500mg when freefall is detected.

(microbit-accelerometer-freefall)
(microbit-accelerometer-freefall-strength)

Rotation (degrees) sensor

Pitch ...
0 : flat
-90 : pins up facing away from me
0 : upside down
+90 : pins down facing towards me
0 : flat

Roll ...
0 : flat
-90 : vertical facing left
-179/+180/+179 : upside down
+90 : vertical facing right
0 : flat

[diagram of an aeroplane]


Radio

Send a number to all other microbits in the same radio group
Send a string to all other microbits in the same radio group
Send a string and a number to all other microbits in the same radio group
Change radio group
Set transmit power (link)
Send serial (anononymous transmission) (link)
Send packet to serial port (link)


Magnetic force
https://makecode.microbit.org/reference/input/magnetic-force


Challenges

To Do : Convert all scripts to use functions where possible.
To Do : Score the challenges - 1 for each block (least efficient version), 2 for forever and onstart, 2 for each gesture or button press, 10 for any sound, 5 for LED plotting, 5 for chart, 30 for any radio communication, 5 for repeat, 10 for while / for, 2 for each part of if statement, 10 for any use of variables, 2 for maths or random numbers, 20 for any appropriate use of functions (i.e. not just to structure code), 20 for arrays, 5 for any text handling, 20 for use of the game library functions, 2 for images, 30 for any use of pins, 50 for use of serial or control.

01. Message

BL / PY : Display a simple, 'Hello World!', once on the Micro:bit display.
BL / PY : Change your script so that the message displays forever.
BL / PY : To be honest, it might be nice if you controlled what the micro:bit said - change your script so that it displays 'Hello World!' when you press button A, 'Goodbye Cruel World!' when you press button B.
PY : I'd rather not wait for each message to display before I view the next one - change the micropython script to stop the micro:bit waiting for the message to finish displaying.
PY : If you really fancy a challenge, try changing the script so that it speaks the messages (with the built in speech synthesiser) instead of displaying them!
PY : The speech is really quiet - add a smiley face on button A press and a sad face on button B - make sure that it displays before the speech starts!

(microbit-message-one-once)
(microbit-message-one-forever)
(microbit-message-two-on-button-press)
(microbit-message-two-on-button-press-no-wait)
(microbit-message-two-on-button-press-speech)
(microbit-message-two-on-button-press-speech-faces)

02. I ♥ micro:bit!

PY : Display a scrolling message on the screen "I ♥ micro:bit!" You will have to split up the message into three separate parts - make sure you put a pause in after displaying the ♥ or else you won't see it! Mess about with the timing of the display to make your message just right :)
PY : Extend your script by making the heart flash on and off three times before displaying the rest of the message. Consider using Image.HEART_SMALL to make the animation look a little nicer.

(microbit-i-heart-microbit)
(microbit-i-heart-microbit-flashing-heart)

03. Rock, paper, scissors

BL / PY : Make a rock paper scissors game that you can play with your friends. The micro:bit should respond to being shaken by selecting one of three images, a rock, a piece of paper or a pair of scissors. The image should clear after 2s.
BL / PY : Add a countdown (3, 2, 1) after you shake the micro:bit before it chooses the random image.
BL / PY : Adapt your game by including a scoring system. If you win, press button A to add 1 to your score, display a smiley face, wait 1s and clear the screen. Pressing button B will scroll your score on the screen like 'Score : x'.

You can also visit this page to make a cool (?) bracelet to mount your micro:bit on your wrist.

(microbit-rock-paper-scissors)
(microbit-rock-paper-scissors-countdown)
(microbit-rock-paper-scissors-countdown-score)

04. Cyber pet

BL / PY : Write a cyber pet game. When the game starts, your pet is happy but gets more sad the longer you leave him alone. If you tickle him (button_a) or feed him (button_b), you restore him to his highest level of happiness. If you leave him untickled or unfed for more than 30 seconds, he will die. Make sure you animate the pet on the screen - you can use different faces to make your pet more lifelike. WARNING : This is hard!

(microbit-cyber-pet)

05. Tilt

BL / PY : Using the game library, design a script which allows you to move a 'dot' around the screen by tilting the micro:bit forwards, backwards, left or right using gestures. Using the game library makes it easier to move the dot, though you could try and do it without the game library for a challenge!
BL / PY : The only issue is that you have to return the micro:bit to flat and reapply to gesture to keep the dot moving. Change your script so that dot with move as long as you hold the micro:bit in that direction and stop it moving if you return the micro:bit to 'face up'.
BL / PY : Now adapt your script so that you use the accelerometer x and y position to move your dot around the screen. I've found that limits of -200 and 200 seem to work quite well. Since the accelerometer will continually register the tilt of the micro:bit, it will keep moving whilst you are tilting the device so you might have to use pauses to slow things down a bit or else your dot will constantly end up on the edges of the screen!

(microbit-tilt-gestures)
(microbit-tilt-gestures-automatic)
(microbit-tilt-accelerometer)

Special Prize! Ask your teacher to give you a copy of some instructions to make a game called 'Catch me if you can' where you tilt your micro:bit to get your dot to try to catch a flashing ghost. You've got 30 seconds to get as many points as you can! 

(microbit-catch-me-if-you-can-accelerometer)

06. Dice

BL / PY : Code a dice which shows a random number between 1 and 6 on the display when you shake your micro:bit.
BL / PY : Now try to code a dice which shows an image of a dice face when you shake your micro:bit.

(microbit-dice-with-numbers)
(microbit-dice-with-images-basic)
(microbit-dice-with-images-array)

07. Smiley and sad buttons

BL / PY : Create a script which displays a smiley face whilst you keep button A pressed down and a sad face whilst you keep button B pressed down. When you let go of either button, the screen clears!
BL/PY : Animate your faces so that each face cycles with the 'confused' face. HINT : You will have to add a sleep(500) to the micropython script after each image or the faces will change too quickly!

(microbit-smiley-sad-buttons)
(microbit-smiley-sad-animated-buttons)

08. Smiley up (and down)

BL / PY : Create a script which displays a smiley face on the LED display when the logo on the front of your micro:bit faces upwards (and towards you). Use gestures to do this rather than the accelerometer.
BL / PY : Now add to your script so that when you turn your micro:bit upside down with the logo facing downwards (and towards you), it still shows a smiley face! To do this, you will have to create your own LED patterns for a smiley face and an upside down smiley face (i.e. not a sad face!) 

(microbit-smiley-up)
(microbit-smiley-up-and-down)

09. Beating heart

BL / PY : Draw an image of a heart on the LED display and then make the heart 'beat' by pulsing through brighter to dimmer and back again for ever. It might be better if you don't take the brightness right down to 0 so the LEDs stay lit - it'll look better. HINT : If you are trying this in micropython, firstly, it's hard and secondly, the range of brightness goes from 0 (off) to 9 (brightest).

(microbit-beating-heart)

10. Spinning arrow of doom

BL / PY : Produce an animation that shows all the arrows in the arrows collection one after the other for ever. You can do this by displaying each arrow in the collection one at a time manually or by looping through an array. If you are using micropython, there is already a collection built for you called Image.ALL_ARROWS!

(microbit-spinning-arrow-basic)
(microbit-spinning-arrow-array)

11. Keep right (straight on or left?)

BL / PY : Embedded computer systems are used to control traffic signals. Produce a continuous animation which shows a south east arrow for 1s followed by a clear display for 0.5s - "Keep right!"
BL / PY : Now change your script so that the default behaviour is to keep straight on (north arrow) but if you press button A, it shows keep left (south west arrow) or if you press button B, it shows keep right (south east arrow). Both buttons would set the display back to 'keep straight on'. NOTE : The micropython version of this must use the button.is_pressed() method which doesn't behave as nicely in this situation as the block version :(

(microbit-keep-right)
(microbit-keep-straight-left-right)

12. Smile for the camera

BL / PY : Write a program which displays a sad face until you press button_a when your micro:bit smiles at you - a bit like when your friend smiles for a photo!
BL / PY : If you have a speaker to connect to your micro:bit, you could add a 'BA_DING' sound when you press the button (unless you fancy making your own shutter sound!) but, the sound should only play once ...

(microbit-smile-for-the-camera)
(microbit-smile-for-the-camera-shutter-sound)

13. Zoo

BL / PY : Get your micro:bit to display a cow when button A is pressed, a giraffe when button B is pressed, a rabbit when both button A and B are pressed and a blank screen when no buttons are pressed. If you are coding this in micropython, you have to be very careful with the order in which you check your button presses ...
BL / PY : Change your script so that the micro:bit displays a blank screen when no buttons are pressed instead of a picture of a ghost.

(microbit-zoo)
(microbit-zoo-no-ghost)

14. Dot

This challenge uses the 'game' blocks / commands. There is no game library in micropython, so, whilst it's possible to complete this challenge in micropython, you would have to code the sprite yourself.

BL : Use the 'game' and variables blocks to create a sprite called 'dot' and display him on the screen at position (2,2). When button A is pressed, dot should move left (x changes by -1) and when button B is pressed, dot should move right (x changes by 1). Dot doesn't move past the edge of the display (the game blocks stop this from happening).
BL : Add another event into your script so that you can move dot forward by pressing both buttons together. The only problem is that there is no way of moving him backwards, so, when he reaches the top of the display, move him back to the bottom on the next button press. This allows you to reach every position on the display.

(microbit-dot-left-right-buttons)
(microbit-dot-left-right-forward-buttons)

Special Prize! Ask your teacher to give you a copy of some instructions to make a game called 'Catch me if you can' where you use the hardware buttons to move your dot to try to catch a flashing ghost. You've got 30 seconds to get as many points as you can! 

(microbit-catch-me-if-you-can-buttons)

STILL TO SORT OUT ...

Basic Programming
  1. Spirit level (link) (link)
  2. Truth or Dare (link)
  3. Magic 8 Ball (link) (link) (link)
  4. Slalom (link)
  5. Magic button (link)
  6. Guess the number (link)
  7. Coin flipper (link)
  8. Blinky (link)
  9. Name tag (link)
  10. Rando (link)
  11. Plot acceleration (link)
  12. Plot light level (link)
  13. Plot analogue pin (link)
  14. Game of life (link) - you might have to just download this script!
  15. Compass (link)
  16. Karel the LED (link)
  17. Egg and spoon race (link)
  18. Stop watch (link)
  19. Beautiful image (link)
  20. Lucky 7 (link)
  21. Answering machine (link)
  22. Game of chance (link)
  23. Magic logo (link)
  24. Snowflake fall (link)
  25. Screen wipe (link)
  26. Blink (link)
  27. Night light (link)
  28. Game counter (link)
  29. Spinner (link)
  30. Looper (link)
  31. Strobe light (link)
  32. Digital yoyo (link)
  33. Rotation animation (link)
  34. Zoomer (link)
  35. Glowing pendulum (link)
  36. Classic beatbox (link)
  37. Speed game (link)
  38. Pacman (link)
  39. Catch the egg (link) (link)
  40. Earthquake meter (link)
  41. Show a number on the display between 0 and 9
  42. Scroll a string on the display / change the speed of the scroll (PY/JS)
  43. Store a number 0 in a variable and display it. Increment it when you shake the micro:bit
  44. Count down from 9 to 0 with a pause of 200ms between each number.
  45. Store your name in a variable and scroll it on the screen. Change the speed of the scroll (PY/JS)
  46. Join your first name, middle name and surname and scroll this on the screen. Do it using variables.
  47. Count and display the number of times you press button A (link)
  48. Draw a diagonal line on the screen by plotting points using a loop (link)
  49. Spinning arrow (link)
  50. Define a boolean variable based on button press and display 1 or 0 (link)
  51. Calibrate the compass when both buttons are pressed (link)
  52. Show a 1 if pin0 is pressed, else show 0 (link)
  53. Display the temperature in Degrees Fahrenheit (link)
  54. Microbit spirit level (link)
  55. Metal detector (link)
  56. Show the running time when a button is pressed (link)
  57. Change the accelerometer range
  58. Play a musical scale (hardware required or use simulator)
  59. Play a tune (using play tone) (link)
  60. Play a tune (greensleeves?) playing each note individually and using a list. Store the notes in a list and play a tune by going through the list
  61. Cycle through a range of frequencies and play a sound like a siren. (link)
  62. Monitor the x, y or z axis acceleration value by playing a ringtone through pin0 (link)
  63. Play a melody and use the hardware buttons to speed it up or slow it down (link)
  64. Use the plot function to draw a square around the edge of the screen (link)
  65. Using plot and unplot, create a flashing dot in the centre of the screen.
  66. Using the toggle function, create a flashing dot in the centre of the screen.
  67. Plot a graph of the approximate distance between two microbits (using radio) (link)
  68. Draw a square using a game sprite
  69. Create a 'KITT' (Knight industries Two Thousand) style scanner (link) - manually do this with micropython and add a trail as an extension to make it even more KITT like (microbit-KITT)! Practical extension - do this with LEDs / neopixel (8 on the original car).
  70. Create an image and have it scroll from the bottom to the top of the screen (offset)
  71. Show the asleep icon for 10s and then show the suprised icon (use the running_time() method) (link) (link)
  72. Use the random number function to choose a random name to display from a list (link)
  73. Marble balancing game - keep it in the square
  74. Use the accelerometer to show 'R' when tilted right and 'L' when it is tilted left. Show '-' otherwise. (link)
  75. Play a note of pitch which matches the accelerometer reading (link)
  76. Show all clock 12 clock icons using the compass and modulo arithmetic (link)
  77. PY : Random poetry generator (link)
  78. PY : Singing (link)
  79. Make an image fade in and out.
  80. Make a jumping sprite - start it off at 3,5 and get it to jump when you press 'A'. Try to make it jump smoothly.
  81. Space invaders - code a base which you can move left and right with the 'A' and 'B' buttons. Both buttons fires a missile. Code an alien which starts at the top of the screen and scans left and right twice and then moves down one level on the screen. If the missile touches the alien, it is destroyed and you gain one point. if the alien touches you you die. Every time you kill an alien, the delay on the alien movement reduces by, say 10ms, making it harder and harder to score. You could score lives as well and bonuses depending on which level you manage to shoot the alien on.
  82. Using the BBC micro:bit music library, play a note based on the the reading from the accelerometer. Hint: set the pitch to the value of the accelerometer measurement.
  83. Make the LEDs light up when the magnitude of the acceleration is greater than 1024 milli-gs.
  84. Shake the micro:bit to make the LEDs light up.
  85. Program one microbit to send temperature readings to another one every second to make a datalogger.
  86. Datalogging projects
  87. Bop-it Game (link)
  88. Consonant or Vowel? (link)
  89. Obstacle game (slalom) (link)
  90. Catch the cheese (chase the dot) (link)
  91. Caesar Cipher (link) (link)
  92. Thermin (link) - maybe do this based on the distance from another microbit - one in each hand? z-axis tilt affects volume and proximity affects pitch?
  93. Ping pong (link) - do this by sending a random A or B from one to microbit to the other one and 'return' the serve by pressing the correct button. Alternatively, left and right?
  94. BA_DING! Display a diamond and play the BA-DING noise - use this as part of a scrolling game - jump over obstacles (y=4) and catch flying objects (y=1) by jumping (x=1,y=4).
  95. Create a 0-9 second timer. Clicking A increases the time using a variable from 0 seconds to 9 seconds. Clicking button B starts the countdown. A sound plays at the end of the time.
  96. Brightness control - use button A to increase the brightness of the display and button B to decrease it. Remember to keep the brightness in the range 0 to 9.
  97. Soundboard - use A and B keys to move dot around the screen and play a different tune depending on which dot the dot is on by pressing A and B together.
  98. Etch-a-sketch - use A and B to move the dot around the screen and A+B to toggle pen up and pen down.
  99. SOS / SMS : button A plays the SOS morse code and button B plays the SMS morse code sound.
  100. Random music player - choose from 5 random tunes on press A and repeat each tune for ever. Cancel tune by pressing button B.
  101. Temperature alarm - sound an alarm and show a sad face if the temperature goes above 30 degrees. If the temperature is 30 or less, the microbit is silent and a happy face shows.
  102. Stopwatch - use runningtime to display the time elapsed from pressing button A to pressing button B. You could extend this to starting the timer on a radio broadcast from another microbit to make a remote datalogger.
  103. Reaction timer - press button A, wait random time between 0 and 10 seconds, display target image and make a note of start time using running_time(). When button B is pressed, stop the timer and display the time. Cross curricular project with Science.
  104. Alarm system - use button A to set the alarm. Any digital touch on pin0 with set off a buzzer. Cancel the alarm by pressing button B.
  105. Play one of three tunes by touching pins 0, 1 or 2. Like an icecream van.
  106. Analogue timer. Press button A for the number of seconds to display (microbit-analogue-timer)
  107. Helicopter - simulate a helicopter by showing all hands in ALL_CLOCKS.
  108. Checkerboard flash - show a copy of the checkerboard image, invert and show and repeat for ever. (microbit-checkerboard-flash)
  109. Hangman - cycle through hangman images pressing button a. When the last one is shown, play game over.
  110. Sidescroller - define a large landscape image with pixels of variety of brightnesses and scroll right to left using shift().
  111. Space game - define a large image with dim pixels of stars and scroll the image down the screen using shift()
  112. Fruit catcher game - fruit falls from the top of the screen and you have to move the 'dot' left and right to catch it. As the game progresses, the fruit starts to fall faster.

Team programming

  1. Mood radio (link)
  2. Salute! (link)
  3. Tele-potato (link)
  4. Hot or cold (link)
  5. Voting machine (link)
  6. Infection (link) - written in Javascript (does not support blocks)
  7. Fireflies (link) (link)
  8. Rock paper scissors teams (link)
  9. Microcoin (link)
  10. Telegraph (link)
  11. Pogo (link)
  12. Charting (link) - science activity
  13. Seismograph (link) - science activity
  14. Prank wifi (link)
  15. Charades (link)
  16. Program two micro:bits to send secret messages to each other (link)
  17. Morse code (link) (link) add a tone onto the transmitted and receiver short sound for dot and long sound for dash.
  18. TV Tuner - program three microbits to 'transmit' different programs on different radio channels (wildlife, comedy, drama, ghost story). One microbit is the receiver and you use button A to move down the channels and button b to move up the channels.
  19. Game show buzzers - 4 contestant buzzers and one receiver (microbit-game-show-contestant) (microbit-game-show-host)

Physical Computing (only available during code club)

Hack your headphones (link)
Banana Keyboard (link)
Guitar (link)
Ducktape wallet (link)
Watch including countdown timer and digital watch (link)
Soil moisture meter (link)
Reaction timer (link)
States of matter (link)
Inchworm (link)
Milk carton robot (link)
Milk monster (link)
Remote control car (link)
Timing gates (link)
Railway crossing (link)
Happy birthday (link)
Music (link)
Random neopixel (link)

Physical computing

Input / output (link)
Music (link)
Storing files on the microbit using micropython (link)



Tips and Tricks

There is an error with my code but I can't see it!

All the messages that Micropython generates pipe down the serial port so you can view them by ...
- if you are working on a version of Windows before Windows 10, install the Mbed serial driver;
- check out 'Device Manager > Ports (COM & LPT)' and make a note of the COM port for the mbed device;
- use a tool like Putty to connect a virtual terminal to that port to see your messages.
- more information is available on the Microsoft MakeCode documentation.

If you are using Mu to flash your programs, you can't use Putty to view the serial port messages at the same time because Mu is already using the COM port and you'll get an error message from Mu if you do. However, if you start up Putty after you've flashed using Mu and then reset the micro:bit (to re run the last flashed program), you can see the error messages in Putty. Alternatively, if you start up the REPL in Mu, the flashed program will stall (you'll see the message on the display freeze) and if you reset your micro:bit then, the error will display in the REPL as normal. Either way, you're good!

Download the original program that came with the micro:bit

If you want to put the original program that came with your micro:bit back, download this file and flash it onto the micro:bit. HINT : did you know there is an easter egg on this script? When you see the 'heart' animation, press A and B together to unlock a game of 'Snake'! (source)