Go Down

Topic: Servo motor: PWM or not, which pins? (Read 2187 times) previous topic - next topic

nikokazaa

Hy everybody,

i'm writing a script in MATLAB to control a digital servo motor Savox 1268sg  with Genuino board, i've connected the servo control to pin 4 that isn't PWM but everything works fine and servo moves exactly; i've read in many articles that servos must cotrolled with PWM mod, for example pin 3. I've tried both, pin 3 and 4, and servo works in the same way.

Does anyone known why?

Thanks in advance,
Niccolò

Robin2

The Servo library can control a servo using any pin. Because the Servo library uses hardware Timer1 you cannot use PWM on the pins controlled by Timer 1 while using the Servo library. On an Uno they are pins 9 and 10. RTFM

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

nikokazaa

Ok i understand the first part relative to MATLAB servo library, but i don't understand what i should doing with pin 9 and 10 that i cant't do with pin 4.

MarkT

pins 3,5,6,9,10,11 support hardware PWM on the ATmega328, pin 4 does not.

The Servo library can drive any pin at all because it is done in software, not hardware,
using interrupts from timer1 (which controls PWM on pins 9 and 10).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up