#include #define SDA_PIN D0 #define SCL_PIN D1 #define LED_PIN D8 // D5 for Secondary 2 #define MY_ADDRESS 0x01 // 0x02 for Secondary 2 void receiveEvent(int howMany); void setup() { pinMode(LED_PIN, OUTPUT); Wire.setSDA(SDA_PIN); Wire.setSCL(SCL_PIN); Wire.begin(MY_ADDRESS); Wire.onReceive(receiveEvent); Serial.begin(115200); Serial.print("Secondary at 0x"); Serial.print(MY_ADDRESS, HEX); Serial.println(" ready."); } void loop() { } void receiveEvent(int howMany) { while (Wire.available()) { int cmd = Wire.read(); if (cmd == 1) { digitalWrite(LED_PIN, HIGH); delay(1000); digitalWrite(LED_PIN, LOW); } } }