#include "TinyWireS.h" // wrapper class for I2C slave routines #define I2C_SLAVE_ADDR 0x26 // i2c slave address (38) #define LED1_PIN 7 // ATtiny Pin 3 #define LED2_PIN 8 // ATtiny Pin 6 void setup(){ pinMode(LED1_PIN,OUTPUT); // for general DEBUG use pinMode(LED2_PIN,OUTPUT); // for verification digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(7, LOW); // turn the LED off by making the voltage LOW TinyWireS.begin(I2C_SLAVE_ADDR); // init I2C Slave mode delay(1000); // wait for a second } void loop(){ byte byteRcvd = 0; if (TinyWireS.available()){ // got I2C input! byteRcvd = TinyWireS.receive(); // get the byte from master // byteRcvd += 10; // add 10 to what's received // TinyWireS.send(byteRcvd); // send it back to master digitalWrite(7, HIGH); //alive delay(2000); digitalWrite(7, LOW); delay(2000); if(byteRcvd!=0){ digitalWrite(8, HIGH); //blue led= receive delay(2000); //digitalWrite(8, LOW); //delay(2000); } } }