#include "TinyWireS.h" // wrapper class for I2C slave routines #define I2C_SLAVE_ADDR 0x2 // i2c slave address (38) #define LED1_PIN 2 // ATtiny Pin ESTO ES LA 1 PLACA byte byteRcvd = 0; void setup(){ pinMode(LED1_PIN,OUTPUT); // for general DEBUG use TinyWireS.begin(I2C_SLAVE_ADDR); // init I2C Slave mode } void loop(){ if (TinyWireS.available()){ // got I2C input! byteRcvd = TinyWireS.receive(); // get the byte from master if(byteRcvd == 1) { digitalWrite(LED1_PIN,HIGH); } else { digitalWrite(LED1_PIN,LOW); } // TinyWireS.send(byteRcvd); // send it back to master } }