document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #define I2C_SLAVE_ADDRESS 0x5 // Address of the slave
  2.  
  3. #include <TinyWireS.h>
  4.  
  5. int i=0;
  6.  
  7. void setup()
  8. {
  9.     TinyWireS.begin(I2C_SLAVE_ADDRESS); // join i2c network
  10.     TinyWireS.onRequest(requestEvent);
  11.  
  12. }
  13.  
  14. void loop()
  15. {
  16.     // This needs to be here
  17.     TinyWireS_stop_check();
  18. }
  19.  
  20. // Gets called when the ATtiny receives an i2c request
  21. void requestEvent()
  22. {
  23.     i = analogRead(A3);
  24.     TinyWireS.send(i);
  25.     //i++;
  26. }
');