#include <Servo.h>
Servo arm;
int ldr=A0,r,l=11;
void setup() {
arm.attach(10);
pinMode(ldr, INPUT);
pinMode(l, OUTPUT);
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
r=analogRead(ldr);
Serial.println(r);
if (r>150)
{
digitalWrite(l, LOW);
arm.write(0);
}
else if (r<=150)
{
digitalWrite(l, HIGH);
arm.write(20);
}
delay(100);
// put your main code here, to run repeatedly:
}