Facebook
From greatech, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 303
  1. #include <LiquidCrystal.h>
  2.  
  3. int sensorPin = A0;
  4. int sensorInput;
  5. double temp;
  6. LiquidCrystal lcd(12,11,5,4,3,2);
  7.  
  8. void setup()
  9. {
  10.   lcd.begin(16,2);
  11.   Serial.begin(9600);
  12.   lcd.print("Temperature: ");
  13. }
  14.  
  15. void loop()
  16. {
  17.   sensorInput = analogRead(A0);
  18.   temp = (double)sensorInput / 1024;
  19.   temp = temp * 5;
  20.   temp = temp - 0.5;
  21.   temp = temp * 100;
  22.  
  23.   Serial.print ("Temperature: ");
  24.   Serial.println(temp);
  25.  
  26.   lcd.setCursor(0,1);
  27.   lcd.print(temp);
  28.  
  29. }