> For the complete documentation index, see [llms.txt](https://docs.feelix.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.feelix.xyz/downloads/arduino-library-documentation/i2c-communication.md).

# I2C Communication

### Master request/send data

The master sends data to and requests data from slaves, including an 8-bit packet ID. Each slave uses this ID as an index into its callback function array to determine which function to execute.

<figure><img src="/files/vuob4DzVKf9umPCymsWr" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/eQjgfxYSdkJYfAiW03Th" alt=""><figcaption></figcaption></figure>

### Slave Return

Upon a request, the slave responds with a message containing a slaveCallbackIndex. The master uses this ID to select the corresponding callback function.&#x20;

<figure><img src="/files/DpaHmA82f98RQ2rPZcIr" alt=""><figcaption></figcaption></figure>

### I2C Setup Master

The examples use the DOIT ESP32 DEVKIT V1 as the master. The ESP32 is connected to the Feelix motors through the Feelink board.

<figure><img src="/files/UGjmGr22jZFNFTg9eoxz" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Default I2C pins on DOIT ESP32 DEVKIT are \
SCL GPIO22 \
SDA GPIO21\
\
Alternatively you can use \
SCL GPIO32 \
SDA GPIO33
{% endhint %}

### I2C Setup Slaves

The slaves can be connected with JSH cables to the FeeLink board.\
The **3.3V outputs** do **not** have to be connected.

<figure><img src="/files/XplxkmXrxd9PJYsOhh1e" alt=""><figcaption></figcaption></figure>
