This is a series of projects that grew from an introductory set of group workshops that we wrote for a local school's open day to promote their Code Club. Projects 1 to 3 ran for about 20 minutes each, and projects 4 and 5 became workshops at the Code Club where I volunteer (these can each be completed within an hour). These projects were easily completed by kids from ages 7-11. The projects that use multiple micro:bits are scaleable and can work well with any number of micro:bits from 2 to class sets; with the option for kids to collaborate in pairs or larger groups.
Project 1: Tilt and Point
This project requires no prior experience with writing code or the micro:bit. You will need some basic computer skills, such as knowing how to launch programs, use a web browser, and plugging in a USB cable.
Although this tutorial talks about saving a
.hex file onto your micro:bit, you can also send the code to your micro:bit directly from the browser or by using a bluetooth connection. Here is a tutorial to help with these other methods of getting your code onto your micro:bit
In this project, you will learn:
- How to use the micro:bit’s built-in accelerometer sensor to detect when it is being tilted left and right (input)
- How to use the
if..then(conditional) block to display image on the micro:bit’s LED matrix display
- Use a
foreverloop to repeat this (iteration)
You will need:
- A micro:bit (V1 or V2 is fine) and matching USB cable
- A computer with an Internet connection and a modern web browser
Step 1: Launch your browser, and got to the MakeCode website
- Launch your web browser by clicking on its icon
- Once your web browser loads, click in the address bar at the top and, in the address bar, type in:
Step 2: Write your code
Create a new project by clicking on
Create your code by dragging blocks into the
Hint: for the
show blocks, click on
Basicand go to the
What the code does:
- Clear the micro:bit screen (made up of red lights known as light-emitting diodes or LEDs, for short)
- Check if the micro:bit is being tilted and display and arrow pointing left or right, depending on which direction it is being tilted
- Repeat this forever
Step 3: Copy your code to the mciro:bit and see it run
- Hold your micro:bit carefully by the edges only, and connect it to your computer using the USB cable. Ask for help if you don’t know how to do this. Click the
Downloadbutton in the bottom left corner of your browser window
- Find the
MICROBITfolder and save the hex file in there. You’ll see a light on the micro:bit flashing. When it stops, your code will run. Try tilting the mciro:bit left and right to see the arrows change. Make sure that the correct arrow is displayed, compared to the direction of the tilt.
Congratulations! You’ve written a program on the micro:bit!
This tutorial is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.