#include const int BUTTONS_SLAVE_ADDRESS = 0x08; const int LEDS_SLAVE_ADDRESS = 0x09; void setup() { Wire.begin(); // Join I2C bus as master Serial.begin(9600); } void loop() { // Request button states from buttons slave Wire.requestFrom(BUTTONS_SLAVE_ADDRESS, 1); // Request 1 byte from slave if (Wire.available()) { byte buttonStates = Wire.read(); // Read the button states Serial.print("Button states: "); Serial.println(buttonStates, BIN); // Print the button states in binary // Send button states to LED slave Wire.beginTransmission(LEDS_SLAVE_ADDRESS); Wire.write(buttonStates); Wire.endTransmission(); } delay(500); // Wait for half a second before next request }