LaurentDelaon
Member
HI everybody,
I use pwm control servomotor.
Range is 0..180, so I put 1 by 1 (89,90,91...) degre.
How can I do to obtain 0.1 by 0.1 degre movement ?
I have try increase by 0.1 starting at 87 movement appear at 88 not in 87. to 87.9.
Seem the pwm servo library is set with 4096 (12bits) so I should obtain 180/4096=0.044° increment a least.
I redo this in setup using analogWriteResolution(12);
Seem that with int you have'nt 0.1°...
My clock speed is 96MHz.
Sample code :
Laurent.
I use pwm control servomotor.
Range is 0..180, so I put 1 by 1 (89,90,91...) degre.
How can I do to obtain 0.1 by 0.1 degre movement ?
I have try increase by 0.1 starting at 87 movement appear at 88 not in 87. to 87.9.
Seem the pwm servo library is set with 4096 (12bits) so I should obtain 180/4096=0.044° increment a least.
I redo this in setup using analogWriteResolution(12);
Seem that with int you have'nt 0.1°...
My clock speed is 96MHz.
Sample code :
Code:
#define axeX_PWM_PIN 5
#define axeY_PWM_PIN 6
float valeurCdeX=90,valeurCdeY=90;
void setup (){
analogWriteResolution(12); // analogWrite value 0 to 4095, or 4096 for high
myservoX.attach(axeX_PWM_PIN);
myservoX.write(90);
...
Code:
//sample use in loop
myservoX.write(valeurCdeX);
Laurent.
Last edited: