Created
September 23, 2016 08:39
-
-
Save openopen114/ac0e7f7f8168a640aa9810c190bae30a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); | |
void setup() { | |
lcd.begin(16, 2); //define LCD Size 16 by 2 | |
// lcd line 1 | |
lcd.setCursor(0, 0); | |
lcd.print("Hello, world!"); | |
// lcd line 2 | |
lcd.setCursor(0, 1); | |
lcd.print("openopen"); | |
delay(2000); | |
} | |
void loop() { | |
int LM35value; //LM35 value form A0 | |
double LM35Temp; //temp = value * (5/10.24) | |
LM35value = analogRead(0); | |
LM35Temp = (double) LM35value * (5/10.24); | |
lcd.clear(); | |
lcd.setCursor(0, 0); //line 1 | |
lcd.print("temperature:"); | |
lcd.setCursor(0, 1); //line 2 | |
lcd.print(LM35Temp); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment