#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd (0x27, 16, 2);

#define ldr A0
int intensity;

void setup() {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  lcd.setBacklight(HIGH);
}

void loop() {
  delay(2000);
  intensity = analogRead(ldr);
  if (intensity < 250) {
    lcd.setCursor(0, 0);
    lcd.print("Warna :");
    lcd.setCursor(0, 1);
    lcd.println("Kuning");
    Serial.print("Intensitas : ");
    Serial.println(intensity);
    Serial.println("Warna : Kuning");
  } else if (intensity >= 250 && intensity < 500) {
    lcd.setCursor(0, 0);
    lcd.print("Warna :");
    lcd.setCursor(0, 1);
    lcd.println("Hijau");
    Serial.print("Intensitas : ");
    Serial.println(intensity);
    Serial.println("Warna : Hijau");
  } else if (intensity >= 500 && intensity < 750) {
    lcd.setCursor(0, 0);
    lcd.print("Warna :");
    lcd.setCursor(0, 1);
    lcd.println("Merah");
    Serial.print("Intensitas : ");
    Serial.println(intensity);
    Serial.println("Warna : Merah");
  } else if (intensity >= 750) {
    lcd.setCursor(0, 0);
    lcd.print("Warna :");
    lcd.setCursor(0, 1);
    lcd.println("Biru");
    Serial.print("Intensitas : ");
    Serial.println(intensity);
    Serial.println("Warna : Biru");
  }
}