For our group assignment, we interfaces our two ATTiny 3216 boards, and passed messages via I2C.
If the temperature is over 24.0 ºC, the main boards send a signal of 1 to the secondary, if the temperature is below 24.0 ºC, a signal of 0 is being send.
The secondary board interprets these signals to turn an LED ON of OFF.
The main board also used an OLED on the same I2C bus do display the temperature from the I2C temperature sensorl
#include<Wire.h>intLEDA=0;// PA4intreceivedValue=1;voidsetup(){pinMode(LEDA,OUTPUT);Serial.begin(9600);Wire.begin(9);// secondary ID #9Wire.onReceive(dataReceive);}voidloop(){Serial.println(receivedValue);}voiddataReceive(intnum){if(Wire.available()){receivedValue=Wire.read();if(receivedValue==1){digitalWrite(LEDA,HIGH);}elseif(receivedValue==0){digitalWrite(LEDA,LOW);}}}