int ldr_val = 0; //setting
int led_w = 9; // pin 9 is set to LED white
int led_r = 10; // pin 10 is set to LED Red, Emergency
int led_b = 13; //
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(led_w,OUTPUT); //LED White
pinMode(led_r,OUTPUT); // LED Red, emergency
}
void loop() {
// put your main code here, to run repeatedly:
ldr_val = analogRead(A0); //the value is read by analog at A0
// Serial.println("LDR value is"); // The value read by A0 will print at the screen
Serial.println(ldr_val); //The value read by A0 will print at the screen
//condition of environment
if (ldr_val<500)
{
digitalWrite (led_w,HIGH); //display white
delay(5000);
}
else
{
digitalWrite(led_w,LOW); //none
delay; //
}
}