Arduino – CLCD with I2C – Temp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,16,2); // or 0x3F int temp=A2; float vars; void setup() { lcd.init(); delay(1000); lcd.backlight(); lcd.setCursor(0,0); lcd.print("Temperature"); } void loop() { vars=((analogRead(temp) * 5.0 / 1024.0) - 0.5) * 100; lcd.setCursor(0,1); lcd.print(vars); } |