* To complete this example, you need to prepare 2 mBot/mCore. Upload Program 1 to mBot1/mCore1 and Program 2 to mBot2/mCore2.
|Program 1 – Sending
Upload to mBot1/mCore1
|Program 2 – Receiving
Upload to mBot2/mCore2
This example is implemented by using the mCore onboard IR receiver and IR emitter.
Prepare two mBot/mCore, and upload Program 1 to mBot1/mCore1 while Program 2 to mBot2/mCore2.
Program 1 – Sending a message: Simply press the on-board button and mBot1/mCore1 sounds and sends a message, which is sent by the on-board infrared emitter. The message content can be customized . In this example the message is set as “s”.
Program 2 – Receive messages: As long as the message “s” is received, the mBot2/mCore2 control board will send out red light and the buzzer sounds (imitating the “hit” effect).
If there are other mBots, you can use the example program to communicate and interact between multiple mBots/mCores as long as the messages sent/received are the same.
Point 1 Characters in infrared communication：
The message defined in Block is used as a signal. Fill in English characters or strings which occupies as less space as possible to avoid error when the program is complicated.
Point 2 Block use
block is used to determine whether a signal is matched to a infrared communication. It cannot be replaced by a calculation block in this case.
Point 3 To implement Program 2 you need to drag the communication block out
Use block. You need to select “extensions” – “Communication” in the mBlock menu to drag the Communication block out in the robot module area.
Change the script: When mCore1 senses a strong light, it will send another message When mCore2 receives the message, it will show “full resurrection” with sound and light effects.
Attached -mCore main control board Infrared communication diagram
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.