//load servo library!
Servo myServo;
int photoCellValue;
int mappedValue;
void setup(){
myServo.attach(2);
}
void loop(){
photoCellValue=analogRead(0);//reads value from the photocell
mappedValue=map(photoCellValue,0,1024,1,180);//check in the help, very usefull
myServo.write(mappedValue);
delay(5);
}
No comments:
Post a Comment