#include int LED = 8; void setup() { pinMode(LED, OUTPUT); //sets LED as output TinyWire.begin(1); //stablish an I2C connection on slave #1 TinyWire.onReceive( onI2CReceive );//register event } void loop() { } void onI2CReceive(){ while(TinyWire.available()){ // while the connection is availabe if(TinyWire.read()=='a') // // check if the signal is a { digitalWrite(LED,HIGH); // Turn LED on } else{ digitalWrite(LED,LOW);// Turn LED off } } }