Skip to content


Teleporting duck

Intermediate | MakeCode, Python | Accelerometer, Radio | Communication, Radio waves

Step 1: Make it

What is it?

Make a duck fly invisibly through the air from one micro:bit to another.

2 micro:bits, one being shaken, one shows a duck on its LED display

How it works

  • Flash this program onto two micro:bits, shake one and a duck appears to travel magically through the air from one to the other. Shake the other to send it back.
  • It’s not really magic. It uses the micro:bit’s radio function to send data from one micro:bit to another when the accelerometer detects a shake gesture.
  • The program first sets the radio group to 23. Groups are like channels on walkie-talkie radios; they can be number between 0 and 255. It doesn’t matter what number you pick as long as your friend’s micro:bit is using the same group number, and no-one else nearby is using the same group.
  • When you shake it, it sends the word ‘DUCK’ on that radio group and clears the screen. If either micro:bit receives a radio message (any radio message), a duck icon appears on its display, so you should only ever have 1 duck visible at any time.

What you need

  • 2 micro:bits (or MakeCode simulator)
  • MakeCode or Python editor
  • battery packs (optional)
  • a friend to play with

Step 2: Code it

Step 3: Improve it

  • Find out how far apart you can go for this still to work.
  • Teleport other animals. Would you need to change the picture, the message – or both?
  • What happens if more than 2 of you use the same radio group? How can you fix this?