//Send the temperature over Serial //define the pin constants int ledPin = 22; int button = 23; int relay = 24; int temp = 0; //define button state booleans boolean changed; boolean oldState; void setup(){ //set analog reference to external analogReference(EXTERNAL); //set the led pin to output pinMode(ledPin, OUTPUT); //set the button to input pinMode(button, INPUT); //set the relay to output pinMode(relay, OUTPUT); //set the temperature sensor to input pinMode(temp,INPUT); //Initilize serial communication Serial.begin(57600); } void loop(){ //read and store the button state boolean State = digitalRead(button); //set the led to the button state digitalWrite(ledPin,State); //set the relay to the button state digitalWrite(relay,State); //read the temperature sensor int tempRead = analogRead(temp); //convert to a voltage double tempVolt = tempRead*5./1024.; //convert to degrees Celsius double temperature = (tempVolt-.5)*100.; //Print the temperature over serial Serial.println(temperature); }