Skip to content

Commit

Permalink
Merge pull request #69 from photodude/patch-1
Browse files Browse the repository at this point in the history
Correct Servo frequency to 50 Hz
  • Loading branch information
ladyada authored Nov 26, 2019
2 parents 6552bd0 + 155284d commit 892de54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/servo/servo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMAX 600 // This is the 'maximum' pulse length count (out of 4096)
#define USMIN 600 // This is the rounded 'minimum' microsecond length based on the minimum pulse of 150
#define USMAX 2400 // This is the rounded 'maximum' microsecond length based on the maximum pulse of 600
#define SERVO_FREQ 60 // Analog servos run at ~60 Hz updates
#define SERVO_FREQ 50 // Analog servos run at ~50 Hz updates

// our servo # counter
uint8_t servonum = 0;
Expand All @@ -49,7 +49,7 @@ void setup() {
// that precise. You can 'calibrate' by tweaking this number till
// you get the frequency you're expecting!
pwm.setOscillatorFrequency(27000000); // The int.osc. is closer to 27MHz
pwm.setPWMFreq(SERVO_FREQ); // Analog servos run at ~60 Hz updates
pwm.setPWMFreq(SERVO_FREQ); // Analog servos run at ~50 Hz updates

delay(10);
}
Expand Down Expand Up @@ -99,4 +99,4 @@ void loop() {

servonum++;
if (servonum > 7) servonum = 0; // Testing the first 8 servo channels
}
}

0 comments on commit 892de54

Please sign in to comment.