Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
74
/
86
We need to first understand the following 3 the most commonly used functions under “Radio”:
“set group”
:
Function description: There are a total of 255 different radio channels. The transmitter
and the receiver should be set in the same group to be able to communicate.
“send out number”
:
Function description: send out a number over radio.
“on radio received”
:
Function description: Upon a number is received, it will execute the program inside the
“on radio received” loop.
We will also need to program the receiver to make corresponding reaction based on the received
number.
Notice: the variable "receivedNumber" inside the “on radio received” function represents the
received number.
STEP 2: After knowing how to use the radio function, it is the time to use input modules to trigger the
radio signal. To make it a bit more challenging, we will try to program the micro:bit send out a
message when someone rings the bell, and send out another message when there is just someone
passing by. To achieve this, we will need the button module and a motion sensor. The flow chart
below gives you an idea of how to write the program.