About this project
This project shows how to send radio messages between two BBC micro:bits. One micro:bit will be used by the patient who will press the A button when they feel their heartbeat. The other micro:bit will be used by the nurse and will see a heat symbol flash when the patient presses the button.
What you'll need
2 x BBC micro:bit
1 x Micro USB
1 x Computer or tablet
4 x AAA Batteries & 2 x Battery Holder (optional)
Project walk through
- Go to the BBC micro:bit website, and begin a new project.
- Now click 'Radio' section to find the "radio set group block". This block requests the micro:bit to use the radio module and communicate with other mciro:bits using the same group. Choose a group number that no-one else in the room is using, in this example we've chosen group 1.
- Now it's time to send a radio message. Using the "radio send string" block we'll send the word "beat" each time the patient presses the button.
- Use the emulator to try this out. You when you press A on the micro:bit you should see the antenna flash and a second micro:bit appear. The second micro:bit doesn't do anything yet, so we need to tell it how to receive this message.
- In the 'Radio' section is a "on radio received" block. This is like the "on button pressed" block except instead of running when a button is pressed it runs when a radio message is received. A new variable called 'receivedString' is automatically created - this will contain the string that was received.
- We need to only listen to the "beat" string. You'll need to use blocks from the 'Logic', 'Variables' and 'Text' sections to make an if condition that runs when the word "beat" is received.
- Each time we receive a beat we want to flash a heart symbol on the display.
- Use the emulator to try this out. You when you press A on the micro:bit you should see a second micro:bit appear and flash a heart.
Congratulations! Download this program to two micro:bits and connect the battery packs. Have one person be the patient and press the A button each time their heart beats. Have another person be the nurse and watch the monitor. See how far you away from the patient you can get and still receive their heartbeat.
Next Steps
- Can you modify the program so the receiving micro:bit shows a sad face when no heartbeat is received for 5 seconds? Hint: use a variable that increases every second. When you received a heartbeat set it to zero. If the variable every gets to 5 or above show the warning!
- If you have three or more micro:bits you could manage multiple patients. Can you make the program send different messages for each patient and display them differently?
- What other sensors can you build? Can you connect some wires to a micro:bit to notify you when a door opens or closes?