About this project
This project uses a classroom of micro:bits to pass messages between them in a circle. Each micro:bit listens to the radio for a message that matches the name of the person who is using it, shows something on the LEDs and then sends the name of the person on their left over the radio to continue the chain. When everyone has this working you should see the pictures flash around the circle of the group as the messages are passed on. This project is a good example to see visually where mistakes are made (the pictures stop part way around the circle) and encourages students to work together to compare their code and make sure each program works with the next one in the chain.
What you'll need
One instructor and four or more students each with:
1 x BBC micro:bit
1 x Micro USB
1 x Computer or tablet
Project walk through
Firstly the instructor should program a micro:bit with the solution (see below) before the class. This micro:bit can then be used to start the chain each time it is tried.
This project starts with discussing the idea of the project. You can act it out by having each student say the name of the person beside them when they hear their own name.
The next step is to give the requirements to the class:
- Each micro:bit needs to be in the same radio group (e.g. 42)
- When a radio message is received that matches your name:
- Show an picture on the display (your choice)
- Wait for a second
- Clear the display
- Send a radio message with the name of the person on the left.
I didn't want to show the solution, but I showed what program was using in the Heart Monitor project that we did the previous session. The solution uses all the same blocks so it is a matter of understanding how they work and modifying them for this project. If you have more advanced students this step may be unnecessary.
You can break the project down into some steps the students might find it easier to develop:
- Show the picture when any message is received (confirms in right radio group and messages are detected).
- Show the picture for only one second.
- Only show the picture when your name is received (instructor might have to reprogram the name in their micro:bit to help with testing).
- Send their neighbours name after showing the picture (project complete!).
Test frequently! Whenever someone feels like they have made progress, download that to their micro:bit and start the messages from the instructors micro:bit. When things don't work as expected get students to compare their code to the people beside them and see what is different. See below for common mistakes.
Here is the solution for student Robert who is sitting to the right of Alice. Each student should have the same program with the names changed as appropriate.
In addition if Robert is instructing the class then you need to add the following to send the message when button A is pressed:
Here are some common mistakes students make:
- They have forgotten to join the radio group or are in the wrong group (not receiving anything).
- The use the "on radio received receivedNumber" block - this looks very similar to the receivedString block.
- They are checking against another variable instead of receivedString.
- They clear the display immediately after setting it to their picture - need to add the pause in-between.
- The picture isn't showing for long enough. Check the pause value was changed from the default 100ms to 1000ms.
- They make a variable for the string values instead of using a text block. e.g. making a variable called "alice" instead of using the text block (which is unfortunately hidden under Advanced > Text).
- The transmitter and received don't have matching names, normally due to:
- One side using upper case and the other lower case. e.g. "Alice" and "alice"
- One side having a space character after the name. e.g. "alice" and "alice "
- The sending and receiving names being mixed up. e.g. "robert" and "alice"
- They haven't downloaded the program correctly and the micro:bit is running older software (re-download to confirm).