Guest User

Arduino Thermometer (LM35 + LCD)

a guest
Sep 29th, 2017
5,690
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal.h>        
  2. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  3.  
  4. int value;
  5. float celsius;
  6. const int lmPin = 0; // The analog pin of the LM35
  7.                  
  8. void setup() {
  9.   lcd.begin(16,2);
  10. }
  11. void loop() {
  12.   value = analogRead(inPin);
  13.   celsius = (value / 1023) * 500; // Getting the temperature from the sensor
  14.  
  15.   lcd.clear();
  16.   lcd.setCursor(0,0);
  17.   lcd.print(celsius);
  18.   lcd.print("C");
  19.   lcd.setCursor(0,1);
  20.   lcd.print((celsius * 9)/5 + 32);
  21.   lcd.print("F");
  22.   delay(1000);
  23. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×