온도센서 + LCD
온도를 읽어 LCD에 출력해 온도계를 만들어보자.!
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float temperature;
int reading;
int lm35Pin = 5;
void setup()
{
analogReference(INTERNAL);
Serial.begin(9600);
}
void loop()
{
reading = analogRead(lm35Pin);
temperature = reading / 9.31;
Serial.println(temperature);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(temperature);
delay(1000);
}
짜잔-