Introduction: Thermostat

This project is designed to display the current temperature in the room, and will also go back and forth between Farenheight and Celsius. In addition, it will display a desired temperature which is adjustable with the use of a potentiometer. If the desired temperature is below the room temperature, an led will turn on.

Step 1: Wiring the Hardware

To wire your arduino properly, copy the picture above

Step 2: Add the Code

#include

#include int tempPin = A0; int led = 13; float temp; float settemp; int swtu = 7; int swtd = 6; LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { pinMode (led, 1); Serial.begin (9600); lcd.begin(16, 2); lcd.setCursor(0, 0); lcd.print("hello, world!"); lcd.clear(); EEPROM.read (1); }

void loop() { int tvalue = analogRead(tempPin); float temp = (tvalue / 6.388888888889); lcd.setCursor (0, 0); lcd.print (temp); lcd.print ('F'); Serial.println (temp); settemp = EEPROM.read(1); delay (250); if (digitalRead(swtu) == 1 ) { settemp ++ ; } else { } if (digitalRead (swtd) == 1) { (settemp --); } else { } if (temp > settemp) { digitalWrite (led, 1); } else { digitalWrite (led, 0); } lcd.setCursor (0, 1); 4 lcd.print ("Set To "); lcd.print (settemp); lcd.print ('F'); Serial.println(settemp); EEPROM.write (1, settemp); delay (250); }