Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <LiquidCrystal.h> //library for the LCD display
  2.  
  3. LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //analog output of arduino's pins
  4. int lcdbl = 10; // defining a variable for LCD Backlight: hooking up the lcdbacklight to pin 10
  5.  
  6.  
  7. float temp; //defining a variable
  8.  
  9. int tempPin = 0; //temperature sensor's pin
  10.  
  11. void setup() //run once
  12.  
  13. {
  14. Serial.begin(9600); //set up Serial library at 9600 bps
  15.  
  16. lcd.begin(8,2); // columns, rows
  17.  
  18. digitalWrite(lcdbl, HIGH);
  19. pinMode(lcdbl, OUTPUT); // set pin 11 to output
  20. analogWrite(lcdbl, 255); //setting the backlight on
  21.  
  22. }
  23.  
  24. void loop() // run over and over again
  25.  
  26. {
  27.  
  28. temp = analogRead(tempPin)/9.31; //read the input from analog pin 0 and convert the raw data to Celsius
  29.  
  30. lcd.print(temp); //print the data to the LCD
  31.  
  32. lcd.print("*C"); //print a letter C after the data.
  33.  
  34. lcd.clear(); //clear the display
  35.  
  36. delay(1000);
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement