Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 2.26 KB

radio.rst

File metadata and controls

57 lines (35 loc) · 2.26 KB

Radio Broadcast

The mPython Board provides 13 channeks of 2.4G wireless RF communication. Can realize simple networking communication in a certain area. Under the same channel, members can receive broadcast messages. It's similar, like walkie talkie. Under the same channel, realize the call.

Walkie Talkie

Walkie Talkie

radio

/../../examples/radio/radio.py

First of all we need import radio to import the wireless module. Then radio.on() , turn on the wireless function. Configure wireless channel radio.config(channel) , channel parameter can set 1 ~ 13 channels. Use radio.send() to send a broadcast message, the message type is a string. On the receiving end, on the same channel, use radio.receive() to receive broadcast data. receive(True) The return data type is (msg, mac). mac is the MAC address of the network device, and the addresses are unique. For example, if you want to be a unicast application, you can filter messages sent by other MAC devices. By default, receive() , the returned data type is msg, without MAC address.

Telegraph -------

Based on the above radio learning, we can use the mPython Board to make an unique telegraph! The two mPython Board are spread by radio and Morse code, is there a sense of spy war film? Try it now!

Telegraph

Telegraph

/../../examples/radio/telegraph.py

The above telegraph example, A B button to select the wireless channel, touch T, send telegram. When receiving the telegram, the RGB of the mPython Board will have an indication.