Does anyone know how to change the pps from 50 to 300? I would like to control a digital servo using the arduino mega 2560. Thanks for your help! Beth
Is this some kind of non standard servo? Is its controller happy with a higher PPM frequency?
I am trying to control a digital servo (tried using both the traxxas 2075 and HobbyKing HKSCM9) instead of the standard analog servo (Hitec HS-332HD). This is my first time using arduino so I apologize. I am able to control the analog servo fine but my I think the PWM frequency is off by 6 ie 50 pulses per second for the analog and 300 for the digital. The basic code I am using is below. Thanks again for your help!
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
You talk to digital servos the same way you talk to analogue servos, with 50Hz PPM.
You may want to see if your for loops agree with their comments. ;)
Digital servos need a lot more power though. The arduino might not be able to supply enough current.
Thanks everyone! The servos are working perfectly!