Created
April 11, 2016 07:43
-
-
Save elktros/149bb05ab0fa316848b55ead4ad039a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<LiquidCrystal.h> | |
LiquidCrystal lcd(7,6,5,4,3,2); | |
const int Sensor = A0; | |
byte degree_symbol[8] = | |
{ | |
0b00111, | |
0b00101, | |
0b00111, | |
0b00000, | |
0b00000, | |
0b00000, | |
0b00000, | |
0b00000 | |
}; | |
void setup() | |
{ | |
pinMode(Sensor, INPUT); | |
lcd.begin(16,2); | |
lcd.createChar(1, degree_symbol); | |
lcd.setCursor(0,0); | |
lcd.print(" Digital "); | |
lcd.setCursor(0,1); | |
lcd.print(" Thermometer "); | |
delay(4000); | |
lcd.clear(); | |
} | |
void loop() | |
{ | |
float temp_reading=analogRead(Sensor); | |
float temperature=temp_reading*(5.0/1023.0)*100; | |
delay(10); | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("Temperature in C"); | |
lcd.setCursor(4,1); | |
lcd.print(temperature); | |
lcd.write(1); | |
lcd.print("C"); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment