We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f8e1dd commit 1742fb1Copy full SHA for 1742fb1
examples/servo/servo.ino
@@ -46,6 +46,9 @@ void setup() {
46
pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates
47
48
delay(10);
49
+ setServoPulse(7, 0.001);
50
+ while (1) ;
51
+
52
}
53
54
// you can use this function if you'd like to set the pulse length in seconds
@@ -58,7 +61,7 @@ void setServoPulse(uint8_t n, double pulse) {
58
61
Serial.print(pulselength); Serial.println(" us per period");
59
62
pulselength /= 4096; // 12 bits of resolution
60
63
Serial.print(pulselength); Serial.println(" us per bit");
- pulse *= 1000;
64
+ pulse *= 1000000; // convert to us
65
pulse /= pulselength;
66
Serial.println(pulse);
67
pwm.setPWM(n, 0, pulse);
0 commit comments