#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Alamat I2C untuk LCD 16x2
const int lm35Pin = A2; // Pin analog untuk sensor suhu LM35
void setup() {
lcd.begin(16, 2);
lcd.print("Sensor LM35");
delay(2000);
}
void loop() {
float suhuCelsius = bacaSuhuLM35();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Linova Maidiana");
lcd.setCursor(0, 1);
lcd.print("Suhu: " + String(suhuCelsius) + " C");
delay(2000);
}
float bacaSuhuLM35() {
int sensorValue = analogRead(lm35Pin);
float suhuCelsius = (sensorValue * 5.0 / 1024.0) * 100.0;
return suhuCelsius;
}