Go Down

Topic: Servo twitches on my tankbot (solved - analogWrite/servo library clash) (Read 1 time) previous topic - next topic


So on my ATmega1280, I need to go look up which are on Timer1 and avoid them like the plague :D

No, not at all, to the contrary Timer1 attached PWM ports are safe unless you attach more than 12 servos. On the ATmega128 the Servo library uses Timer5 for the first 12 servos, then as needed Timer1, Timer3 and Timer4 for the next 12 servos in this order for a total of 48 servos. It's defined in Servo.h. But basically, the same applies, don't use analogWrite on ports connected to the timer used by the Servo library. If I remember correctly, on the ATmega128 the 16-bit timers (which the Servo library uses) have 3 PWM ports attached. Better check the data-sheet for the real truth.



Go Up