#define LDR A0
#define Red 10
#define Green 9
int data;
void setup() {
// put your setup code here, to run once:
pinMode(Red, OUTPUT);
pinMode(Green, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int Idrstatus = analogRead(A0);
Serial.print("Ldrstatus ");
Serial.println(Idrstatus);
if (Idrstatus >= 600)
{
digitalWrite(Red,HIGH);
digitalWrite(Green, LOW);
}
else
{
digitalWrite(Red,LOW);
digitalWrite(Green, HIGH);
}
delay(1000);
}