An example of solving a problem on the interaction of two robots

The task

Send message "5" from one robot and receive it on another.
Please note that the task can only be solved in real robot mode.


To solve the problem, you have to:
  1. 1.
    Write a message transmission algorithm for the leading robot.
  2. 2.
    Write a message reception algorithm for the second robot.
  3. 3.
    Connect robots to a single network.
  4. 4.
    Run programs on robots.

Message transmission algorithm

1. Switch TRIK Studio to the real robot mode.
2. Enter a message variable for the message and initialize it by assigning it the number 5 in the "Expression" block.
3. Add "Send message" and "End" blocks. In the properties of the "Send message" block, specify the onboard number of the robot to which you want to send the message and the variable containing the message.

The complete algorithm

Message reception algorithm

1. Switch TRIK Studio to the real robot mode.
2. Add the "Receive message" block. In the block properties, specify the variable in which you want to write a message sent from another robot. The variable can be named whatever you want. Set the "Wait for message" property to true.
3. After the message has arrived, display it on the robot's screen for 3 seconds, and then finish the algorithm. To do this, add blocks "Print Text", "Timer" and "End". In the properties of the "Print text" block, check the Calculate box and specify true in the "Update image" field.

The complete algorithm