Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- //initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(2,3,4,5,6,7);
- const int TempPin=A0;
- int tempVal=0;
- void setup()
- {
- // put your setup code here, to run once:
- //set up the number of columns and rows on the LCD
- lcd.begin (16,2);
- lcd.setCursor (1,0); //3 is the 4th column, 0 is the first row)
- lcd.print ("The temperature");
- //set the cursor to column 0, line 1
- //line 1 is the second row, since counting begins with 0
- lcd.setCursor(2,1);
- //pring to the second line
- lcd.print("right now is");
- Serial.begin(9600);
- }
- void loop()
- {
- delay (3000);
- tempVal=analogRead (TempPin);
- tempVal=map (tempVal,850,970,50,90);
- Serial.println (tempVal);
- lcd.clear();
- lcd.setCursor (5,1); //because the column changes but row is the same
- lcd.print(tempVal);
- }
Add Comment
Please, Sign In to add comment