I2c communication between arduino nanos

Hello to everyone,
I simply try to connect 2 Arduino Nanos via I2C Bus to send simpel Bytes (2 in count).
I have both connected : A4-A4; A5-A5 (both with 10k PullUp) and ground.
I try this script:

(read bytes with LED feedback for Byte 1 = 01h)

(write on button trigger bytes 01h and 02h + count errors)

And every time I try this, I count errors on every Trigger. Nothing more happens.

Or is the better way to use UART?
(the nanos will be outside in 1m distant; one read sensors and prozess the data, the other(Nr2) control the motors along with the orders from Nr1)

Hi! @sc-v
To communicate between two Arduinos via I2C, you need one of the Arduino to act as a slave.
At the moment, the XOD I2C library does not provide such functions, so Arduino can only act as a master. This is because the I2C slave events are triggered by hardware global interrupts that are not yet implemented in XOD.

In addition, I do not advise you to use I2C at a distance of 1m. This interface designed as a link between multiple devices on the same board. I don’t expect it will work correctly with the 1m wire length. Try UART

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.