> For the complete documentation index, see [llms.txt](https://help.trikset.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.trikset.com/en/trik/wi-fi/interaction/interaction-example.md).

# 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.

{% hint style="warning" %}
Please note that the task can only be solved in real robot mode.
{% endhint %}

## Solution

To solve the problem, you have to:

1. Write a [message transmission algorithm](/en/trik/wi-fi/interaction/interaction-example.md#message-transmission-algorithm) for the leading robot.
2. Write a [message reception algorithm](/en/trik/wi-fi/interaction/interaction-example.md#message-reception-algorithm) for the second robot.
3. [Connect](/en/trik/wi-fi/interaction.md) robots to a single network.
4. Run programs on robots.

### Message transmission algorithm

1\. Switch TRIK Studio to the [real robot mode](/en/studio/interface.md#panel-interpreter).

2\. Enter a `message` variable for the message and initialize it by assigning it the number `5` in the "[Expression](/en/studio/programming-visual/blocks.md#expression)" block.

![](/files/-MSiwWpAYqhPzZBMn2zr)

3\. Add "[Send message](/en/trik/programming-visual/blocks.md#send-message)" and "[End](/en/studio/programming-visual/blocks.md#final)" 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.

![](/files/-MSiw_vsgUJOLzpM7r1H)

#### The complete algorithm

![](/files/-MSiwd_hskl87uZ8IAbs)

### Message reception algorithm

1\. Switch TRIK Studio to the [real robot mode](/en/studio/interface.md#panel-interpreter).

2\. Add the "[Receive message](/en/trik/programming-visual/blocks.md#wait-for-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`.

![](/files/-MSiwntQhMicbewmAij-)

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](/en/trik/programming-visual/blocks.md#print-text)", "[Timer](/en/studio/programming-visual/blocks.md#timer)" and "[End](/en/studio/programming-visual/blocks.md#final)".\
\
In the properties of the "Print text" block, check the `Calculate` box and specify `true` in the "Update image" field.

![](/files/-MSiwrtoIF9Y1swoOabn)

#### The complete algorithm

![](/files/-MSiwx4mLIY5rf0PIsPX)
