Servo motor sweeps beyond 180 I'm trying to get my servo motor to sweep from 0 to 180 degrees then back to 0 degrees for infinite amount of times. I using the following code but my motor keeps resetting when it get backs to 0 degrees (meaning it goes 0-->180-->0 then completes a 360 and starts over). Also the 0-180 degree sweep appears to be more of a 0-270 degree sweep. Anyone running into these problems?

int angle = 0;

void setup() {
  myservo.attach(9);
  myservo.write(angle);
}

void loop()
{
  for (angle = 0; angle &lt; 180; angle += 1)
  {
    myservo.write(angle);
    delay (50);
  }

  for (angle = 180; angle &gt; 0; angle -= 1)
  {
    myservo.write(angle);    
    delay(50);
  }   
}
Is your servo the modified 360 degree type with no position feedback (meaning the internal feedback potentiometer has been disabled)?