> 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)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.trikset.com/en/trik/wi-fi/interaction/interaction-example.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
