eight clock pulses) from the Master to Slaves contain the address of the device the Master wants data from. When the clock pin changes from high to low (the falling edge of the clock), the called upon device transmits a bit of data back to the Arduino over the same line. As the clock pulse changes from low to high (known as the rising edge of the clock), a bit of information is transferred from the Arduino to the I2C devices over the SDA line.
#Arduino i2c example slave serial
The I2C protocol involves using two wires to send and receive data: a serial clock pin (SCL) that the Arduino pulses at a regular interval, and a serial data pin (SDA) over which data is sent between the two devices. Once that message is received, it can then be viewed in the Slave Arduino's serial window. Arduino 1, the Master, is programmed to send 6 bytes of data every half second to a uniquely addressed Slave Arduino. Several functions of Arduino's Wire Library are used to accomplish this. In this example, two Arduinos are programmed to communicate with one another in a Master Writer/Slave Receiver configuration via the I2C synchronous serial protocol.
Sometimes, the folks in charge just don't know when to shut up! In some situations, it can be helpful to set up two (or more!) Arduino boards to share information with each other. Learning Examples | Foundations | Hacking | Links