I have bought two original TowerPro MG966R 360 degree continuos rotation Hi-torq digital servos.
Expected results :
- 90 deg -- no rotation
- 90 - 0 deg -- speeding up to one side
- 90 - 180 deg -- speeding up to the other side
Real results :
- When I am sending 50-90 degrees PWM, they behave like standard (non-continuos) servos and turn in 50-90 degree angle.
- Bellow 50 there is small speedup, then continuos rotation at max speed to one side.
- Above 90 there is continuos rotation at max speed to the other side.
I am using standard Arduino Servo library, servo has external 2A power and all grounds (servo, arduino, power) are connected together.
Both new servos behave same, so I assume fault is on my side (software). Same code and wiring works fine with other (cheap,copycat) servo I have.
May I ask for some pointer to what am I doing wrong?
Thanks
My test code :
// 9 - servo pin
// 2 - pot pin
#include <Servo.h>
Servo srv;
void setup(){
srv.attach(9);
}
void loop(){
//~ srv.write(map(analogRead(2),0,1023,50,90));
srv.write(map(analogRead(2),0,1023,0,180));
delay(10);
}
Bought here : ebay
Manufacturer page : here
mapfunction or theanalogReadfunction ... use minimal code when debugging – jsotola Oct 30 '20 at 18:57