int LedKuning = 21;
int Ledhijau = 4;
int LDR = 32;
int NilaiLDR = 0;
void setup(){
pinMode(LedKuning, OUTPUT);
pinMode(Ledhijau, OUTPUT);
Serial.begin(9600);
}
void loop(){
NilaiLDR=analogRead(LDR);
if (NilaiLDR > 500){
digitalWrite(LedKuning,HIGH);
digitalWrite(Ledhijau,LOW);
Serial.print("Nilai LDR Kuning = ");
Serial.println(NilaiLDR);
}else if (NilaiLDR < 500 ){
digitalWrite(Ledhijau, HIGH);
digitalWrite(LedKuning,LOW);
Serial.print("Nilai LDR Hijau = ");
Serial.println(NilaiLDR);
}
}