//Slave - Attiny44

#include <TinyWireS.h>


void setup() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  TinyWireS.begin(2);                // join i2c bus with address #8  

}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()

void loop() {
  
  char c = TinyWireS.receive();

  //  Serial.println(x);         // print the integer
  //  Serial.println(x%5);
  //  if (x%5 == 0)

  if (c == 'l')
  {
    digitalWrite(2, HIGH);
  }
  if (c == 'n')
  {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
  }         // print the integer
  if (c == 'r')
  {
    digitalWrite(3, HIGH);
  }
}
