Magic Trick
This is how the magic trick works.
The on start block sets the micro:bit's radio group.
A micro:bit can communicate with any other micro:bit with the same radio set group number.
In the example below it is set to 8.
The micro:bit sending out data is called the transmitter.
The micro:bit receiving the data is called the receiver.
Transmitter code Receiver code
Study the code above.
You will see that both micro:bits are set to radio group 8 so that they can communicate with each other.
Transmitter code
The transmitter's radio send number block transmits data to the receiver micro:bit when a button is pressed.
If button A is pressed it will send 1.
If button B is pressed it will send 0.
Receiver code
The receiver's on radio received block sets a variable called 'number' to the data received.
If 'number' = 1 the receiver micro:bit will display a happy face.
If 'number' = 0 the receiver micro:bit will display a sad face.