Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Reading Temperature with LM35 Sensor
- //Measuring in both scales Celsius and Fahrenheit
- //Arduino Thermometer Shield
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
- float tempC;
- float tempF;
- int tempPin = 1;
- void setup(){
- lcd.begin(16, 2);
- lcd.print("Csius=");
- lcd.setCursor(0, 1);
- lcd.print("Fheit=");
- }
- void loop(){
- tempC = analogRead(tempPin);
- tempC = (5.0 * tempC * 100.0)/1024.0;
- tempF = ((tempC*9)/5) + 32;
- lcd.setCursor(6, 0);
- lcd.print(tempC,1);
- lcd.print("'C");
- lcd.setCursor(6, 1);
- lcd.print(tempF,1);
- lcd.print("'F");
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement