
If value received is 3 blink LED for 400 msįirst, let's look at the master. If value received is 0 blink LED for 200 ms X = Wire.read() // read one character from the I2C Attach a function to trigger when something is received. Start the I2C Bus as Slave on address 9 If (x > 5) x = 0 // `reset x once it gets 6Īnd here is the slave code that interprets the characters sent from the master: // Include the required Wire library for I2C#include Wire.endTransmission() // stop transmitting

Wire.beginTransmission(9) // transmit to device #9 First, let's take a look at the master code: // Include the required Wire library for I2C#include The following code is split in two parts: the master code and the slave code, which run on two different Arduinos.
