void setup() {
//define the pin 11 to output a digital signal
pinMode(11, OUTPUT);
//define the pin 6 to input a digital signal
pinMode(6, INPUT);
}
//illumination(Lux) used to mesure the light intensity
//lower value of LUX indicate dark
//Higher value of LUX indicate light
void loop() {
if (digitalRead(6)==LOW){ //read and check the input signal of pin 6 is low (Light)
digitalWrite(11, LOW); //command pin 11 to stop outputting a signal
}
else{ //read and check the input signal of pin 6 is high (Dark)
digitalWrite(11, HIGH); //command pin 11 to Start outputting a signal
}
}