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:
Write a message transmission algorithm for the leading robot.
Write a message reception algorithm for the second robot.
Connect robots to a single network.
Run programs on robots.
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.
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.
TRIK controllers can interact with each other, which makes it possible to solve problems of transferring messages between robots.
For the interaction of controllers, it will be necessary to select a master controller — the one to which we will connect the rest of the controllers. And also connect all controllers to one network. This can be done in two ways:
1. Using the existing network.
2. By creating a Wi-Fi access point on one of the controllers.
1. Select a master controller and connect it to an existing Wi-Fi network in client mode.
2. In the web interface of the master controller, in the "Interaction of robots" field, specify the tail number (usually for the master it is 01, but any other is possible) and its IP address.
3. Connect all other controllers to the same Wi-Fi network in client mode.
4. Specify for each of them in your web interfaces in the "Interaction of robots" field the tail number (different from the others) and the IP address of the master controller.
Also, the flight number and IP address of the master controller can be specified on the controller in the Interaction
menu item.
1. Select a master controller and share Wi-Fi from it using access point mode (select Network → Wi-Fi access point
in the menu).
2. Next, return to the main menu screen and select Interaction
.
3. Specify the tail number (usually for the master it is 01, but any other is possible) and its IP address.
4. Connect the rest of the controllers to the master using the Wi-Fi client mode. To do this, in the web interface of each controller, in the "Wi-Fi client" fields, specify the name and password of the network of the master controller.
5. Open the web interface using the IP address displayed on the controller in Wi-Fi client mode.
6. Specify for each of the controllers in their web interfaces in the "Interaction of robots" field the tail number (different from others) and the IP address of the master controller.
Also, the flight number and IP address of the master controller can be specified on the controller in the Interaction
menu item.
4. On all controllers go to the Interaction
menu item and click the "Connect" button. The icon should appear in the upper right corner of the controller screens.
7. On all controllers go to the Interaction
menu item and click the "Connect" button. An icon should appear in the upper right corner of the controller screens.