This is a radio program so you’ll need 2 micro:bits running to get it to work. The program “sends” a duck using the radio by shacking the micro:bit.
In code, the accelerometer sensor is used in two rules to clear the screen (duck is gone) and send a number using the radio.
- when shake, do clear screen.
- when shake, do radio send 1.
The third rule uses the radio filter to render the duck on the screen. This rule executes when a radio message is received.
- when radio receive 1, do paint duck on screen.
- when radio receive 1, do play sound emoji hello.
Avoiding clashes with groups
If you try this activity with many micro:bits in the same room, they will all start to trigger the activity. You can avoid groups interference by
- have student use a different radio value than 1
- add a rule that runs on the start of the page and sets a different radio group (default is 1)
using
radio set group
. The message only reach other micro:bit in the same group.
Improvement ideas
- add sound emoji when the duck arrives
- use different radio messages for different images