// Include the required Wire library for I2C
#include
int LED = 13;
int x = 0;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// Start the I2C Bus as Master
Wire.begin();
Serial.begin(9600);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
Serial.println("transmission starting");
Wire.beginTransmission(9); // transmit to device #9
Wire.write(x); // sends x
Wire.endTransmission(); // stop transmitting
Serial.println("transmission ended");
x++; // Increment x
if (x > 5) x = 0; // `reset x once it gets 6
delay(500);
}