// Include the required Wire library for I2C #include int oven_relay = 2; int high_temp_limit = 200; int oven_temp = 0; int temp = 0; void setup() { // Define the Oven Relay pin as output pinMode (oven_relay, OUTPUT); // Start the I2C Bus as Slave on address 9 Wire.begin(9); // Attach a function to trigger when something is received. Wire.onReceive(receiveEvent); //bit rate for data transfer over Serial communication Serial.begin(9600); } void receiveEvent(int bytes) { oven_temp = Wire.read(); // read one character from the I2C } void loop() { //potentiometer value from sensor, scale as if it was deg C int temp = map(oven_temp, 0, 1023, 0, 275); if (temp < high_temp_limit) { digitalWrite(oven_relay, HIGH); } else { digitalWrite(oven_relay, LOW); } Serial.print("Oven Temp is: "); Serial.println(temp); Serial.print("Oven Temp Limit is:"); Serial.println(high_temp_limit); Serial.print("Raw value is: "); Serial.println(oven_temp); delay(1000); }