Digital Technologies
Pick a topic on the left, or tap a box on your assessment sheet to open that tutorial.
Work down the yellow boxes first, then follow the arrow
Topic
A micro:bit is a simplified version of a computer that you can program, provide input to, and receive output from.
What do you notice? With this small device you have a simplified version of a keyboard and a monitor. Can you work out where they are?
Buttons A and B take what you press — that is your keyboard. The 5 × 5 grid of red LEDs shows you what the program is doing — that is your monitor.
A peripheral device is any piece of hardware you plug into a computer to get information in or out. Here are the ones you will be using with the micro:bits. Each sensor has its name and type printed on the circuit board — check the board itself if you are not sure what you are holding.
An input device sends information into the computer. An output device takes information out of the computer and turns it into something you can see, hear or hold. A few devices do both.
Your turn — pick a category for each device
0 of 6 sorted
Topic
Your code lives in the browser until you send it to the board. Follow these steps to pair your micro:bit and download straight onto it.
Check the USB cable is a data cable and not a charge-only one, then reload the MakeCode page and try again. You can also choose Download as File and drag the file onto the MICROBIT drive.
Topic
This is the sheet you were given. Every tutorial you finish gets signed off on it.
You are given the code for these.
You need to think a little here.
The biggest challenge — but you have all the required knowledge!
Lost your sheet, or want to check the tasks at home? Download it here and print a new one.
Download the assessment sheetTopic
Tutorial 1A (Control the Light) uses a digital signal. Tutorial 1B (Sunshine Micro:bit) is analogue. What is the difference?
A digital signal only has set steps to choose from — on or off, 1 or 0, nothing in between. An analogue signal is a smooth curve that can sit at any value along the way. To store an analogue signal digitally, a computer samples it at regular moments and rounds each sample to the nearest step.
A digital image is made of a fixed grid of squares. Zoom in far enough and the steps appear.
Real life has no grid. Zoom in on skin and there is always more detail — the steps never appear, because there are none.
Digital
Each square is either on or off. The mouth snaps open and shut — there is no halfway.
Analogue
The light passes through every brightness on its way up and back down again.
Tutorial 1A — Developing
Use the two buttons on the micro:bit to turn an LED on and off.
A red LED is shown in the diagram, but blue, green or any other colour works exactly the same. Avoid the clear ones though — those are usually light sensors rather than LEDs, and you will need one of those for the next tutorial.
The dark red digital write pin block is hidden in Pins. Click Advanced at the bottom of the block list to reveal it.
Tutorial 1B — Developing
Use the LED bar graph on your micro:bit to show the current light level. The stronger the light, the more LEDs turn on.
plot bar graph is in the Led section. analog read pin is in Pins, under the Advanced menu.
Tutorial 2A — Developing
The ultrasonic ranger detects distance. In this demo it checks whether something is too close, and the micro:bit shows a sad face when it is.
From this tutorial onwards you need the Grove blocks. Add the extension to MakeCode before you start.
The diagram does not show the USB cable. That is assumed — your micro:bit always needs to be connected to power to work.
The purple Ultrasonic Sensor (in cm) at P0 block is inside the Grove category. From Logic you need two blocks: the comparison block (0 < 0) and the if / then / else block.
Tutorial 2B — Developing
Read the distance from the ultrasonic ranger and show it as a number.
Two devices, two different ports. Check the ranger is in P0/P14 and the display is in P1/P15 before you download, or the numbers will not appear.
Drag the 4-Digit Display block straight from Grove and it creates the variable 4digit for you. Both blocks must say 4digit — if one of them gets renamed to 4digit2, this will not work. The show number block also comes from Grove; drop the sensor block into its 0 space.
Tutorial 3 — Developing
Drive the RGB LED strip with the rotary dial and light up your desk.
There are 30 LEDs on the strip. You will show rainbow colours along it, then use the rotary angle sensor to make the rainbow flow.
Add a new extension called Neopixel, or none of these blocks will exist. Drag NeoPixel at pin straight from it and the variable strip is created for you — both blocks must say strip, not strip2. show rainbow is also in Neopixel and looks skinnier until you drop the large map block into it. Both map and analog read pin come from Pins.
Code too small to read? Hold CTRL and press + to make everything on the page bigger. CTRL and 0 puts it back.
Tutorial 4 — Class activity
A variable is a labelled container the program uses to remember something while it runs. We will build this one together as a class.
Think of a variable as a container with a name written on the side. The container stays put; what is inside it can change at any moment. When your program asks for the variable by name, it gets whatever is in there right now.
The container
The bucket does not change. The amount of water in it does — and you can pour more in or tip it out whenever you like.
The value
Every time a marble drops in, the number written on the side changes to match. Ask the box how many it holds and it tells you the number it has right now.
In your code you will make two of these containers, called numberOne and numberTwo. The buttons and the shake will change what is inside them.
Watch the explainer videoNo sensors for this one. Everything happens on the board itself: the two buttons, the shake, and the LED matrix.
Create two new variables and name them numberOne and numberTwo. Each one stores a number that gets displayed on the LED matrix. Those numbers are adjusted whenever you press A, press B, or shake the micro:bit.
Code too small to read? Hold CTRL and press + to make everything on the page bigger. CTRL and 0 puts it back.
Consolidating + Extending — Upper
Only after completing all of the tutorials, follow the arrow on the assessment sheet for the consolidating challenges. The extending tasks can be completed in any order.
Combine Tutorial 1a and 1b together, so that they both work at the same time. This means you need to get both segments of code from the first two tutorials and combine them into one code file.
The only tricky thing is that both tutorials expected you to use the same port (Port P0) for their input/output devices. You cannot use the same port for two different devices at the same time, so you will need to shift one of your devices to another port and adjust your code to match.
Alter the code so that the light meter can be turned on by pressing the A button on the micro:bit board, and off when the B button is pressed. The LED peripheral device, when on, will indicate that the light sensor is active. The light sensor will then operate as expected, and the array of lights on the micro:bit (the bar graph) will fluctuate as the light levels change — the code from the consolidating task should already achieve this.
When the LED is off, the bar graph will remain static and will not react to any further changes of the light.
You will need to use a variable to remember which button was last pressed, and incorporate a conditional statement into the forever loop.
Consolidating + Extending — Middle
Only after completing all of the tutorials, follow the arrow on the assessment sheet for the consolidating challenges. The extending tasks can be completed in any order.
Explain how the ultrasonic sensor works, either written or verbal. The main questions you will need to answer are:
If you are really stuck on question 3, look up what echolocation is — that should help you answer it.
Can you change it from 2 stages of warning to 3? (i.e. <10, 10–30, >30). Add in an extra LED light, and get this light to:
Look for the + sign on the conditional statement — this will allow you to add in a third level (if, else if, else).
Consolidating + Extending — Lower
Only after completing all of the tutorials, follow the arrow on the assessment sheet for the consolidating challenges. The extending tasks can be completed in any order.
Replace the rotary dial with a light sensor. Does your program still function? This task requires no change to your coding.
If you look closely at your code you are using an analogue signal input, but it never specified in the code that it had to be a rotary sensor. It did in the tutorial instructions, but not in the actual code. By replacing the rotary sensor with a different analogue sensor, the program can still function happily. It simply does not care, as long as it is receiving the correct type of signal — that is, not digital.
Both analogue sensors are connected, but only one works at a time.
You will need to use a variable to remember which button was last pressed, and incorporate a conditional statement into the forever loop.
If you are not sure how to use a variable for this, the walkthrough video shows you how.
Watch the walkthrough video