LAN
67. broadcast message [message] on LAN
Broadcasts the specified message on the LAN
How to use
Click to set the name of the message to be broadcast.
The message broadcast by CyberPi through this block can be received by all the other devices on the same LAN.
Note:
All CyberPis on the same LAN must use the same channel for communication.
Without router connection, CyberPis use the same default channel and thus can communicate with each other on the LAN; when CyberPi is connected to a router, its channel depends on the setting of the router, which may be different from the default channel, and thus it may fail to communicate with another CyberPi that is not connected to the router.
Therefore, to ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.
Example
The following programs enable two CyberPis to interact with each other.
CyberPi 1
CyberPi 2
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1. CyberPi 2 says “hi.”
68. broadcast message[message]with value[value]on LAN
Broadcasts the specified message with the specified value on the LAN
How to use
Click to set the name of the message and the value to be broadcast.
The message broadcast by CyberPi through this block can be received by all the other devices on the same LAN.
Note:
To ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.
Example
The following programs enable two CyberPis to interact with each other.
CyberPi 1
CyberPi 2
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1.
CyberPi 2 displays the value 1 on its screen.
69. when receiving[message]boadcast on LAN
Executes the subsequent block(s) when the specified message is received
How to use
CyberPi can receive messages broadcast by other devices on the same LAN.
Note:
To ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.
Example
The following programs enable two CyberPis to interact with each other.
CyberPi 1
CyberPi 2
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1. CyberPi 2 says “hi.”
70. LAN broadcast [message]value received
Reports the value received by CyberPi through the specified message
How to use
After being connected to Wi-Fi, CyberPi can receive messages and values broadcast by other devices connected to the same Wi-Fi.
You can select the check box on the left of this block to see the received value on the stage.
This is a reporter block that must be used in combination with another block requiring data.
Note:
To ensure proper communication, if you use a router, connect all CyberPis on the same LAN to the router.
Example
The following programs enable two CyberPis to interact with each other.
CyberPi 1
CyberPi 2
Compile the two programs in Upload mode and upload them to CyberPis 1 and 2, respectively.
Restart CyberPis 1 and 2.
Press button A on CyberPi 1.
CyberPi 2 displays the value 1 on its screen.