#include <Servo.h>
int count;
//create a servo object called servo1
Servo servo1;
void setup() {
// put your setup code here, to run once:
// set the servo pin, pin 9, as an servo output pin
servo1.attach(9);
count = 0;
}
void loop() { // put your main code here, to run repeatedly:
int lightValue = analogRead(A0);
if (lightValue < 25) {
count = 1;
}
if (count > 0 ){
servo1.write(180);
}
// map the light readings to the angle possible by the servo motor
// *normal servo system: lightValue = map (lightValue, 0, 1023, 90, 0);
// control the servo motor based on the light value read, adjust linearly by angles
//* servo1.write (lightValue);
}