deux arduino i2c
deux arduino i2c
com/I2C-between-Arduinos/
https://forum.arduino.cc/t/master-slave-spi-communication-between-two-arduino-uno/626991
Here, we will make an I2C bus using two Arduinos. We will program
one master Arduino to command the other slave Arduino to blink its
built-in LED once or twice depending on the received value.
2 Arduinos
Jumper cables
And here is the slave code that interprets the characters sent from
the master:
Attachments
I2C_master.ino
Download
I2C_slave.ino
Download
#include <Wire.h>
Wire.onReceive(receiveEvent);
And this is the function. Here, we simply store the value of the
received character:
Each I2C bus can support up to 112 devices. All devices need to
share GND. The speed is around 100 kb/s—not very fast but still
respectable and quite usable. It is possible to have more than one
master on a bus, but it's really complicated and generally avoided.