Hello,
That's the old way to use servos, you have now 2 different libraries: servo (you can use many sevos but you need to refresh the position, beware with delay), and servotimer1 (only 2 servos on pins 8 and 9, but refresh is inside the library, more confortable).
A proposition with servo library :
#include <Servo.h>
Servo servo1;
int sensorPin = 0; // light sensor is on analog in 0
int sensorValue01 = 0;
void setup() {
servo1.attach(8);
}
void loop() {
sensorValue01 = analogRead (sensorPin); //value of the light sensor, normaly between 0 ad 1023
int angle = sensorValue / 6; // to obtain angle between 0 and 170
angle = angle + 5; // to obtain value between 5 and 175
servo1.write(angle); //move the servo
Servo::refresh(); // necessary with this library
delay(10); // to cool the jitter?
}
jhoepffner