#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int DataCahaya;
const int Lampu1 = 9;
const int Lampu2 = 5;
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
}
void loop()
{
// put your main code here, to run repeatedly:
DataCahaya = analogRead(A1);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Data Sensor C :");
if (DataCahaya > 400)
{
digitalWrite(Lampu1,HIGH);
digitalWrite(Lampu2,LOW);
}
else if (DataCahaya > 600)
{
digitalWrite(Lampu1,HIGH);
digitalWrite(Lampu2,HIGH);
}
else
{
digitalWrite(Lampu1,LOW);
digitalWrite(Lampu2,LOW);
}
delay(500);
}