A pulse each 20ms digitalWrite(servoPin, HIGH) ĭelayMicroseconds( 1450) // Duration of the pusle in microseconds digitalWrite(servoPin, LOW) ĭelayMicroseconds( 18550) // 20ms - duration of the pusle // Pulses duration: 600 - 0deg 1450 - 90deg 2300 - 180degĪfter some testing I came up with the following values for the duration of the pulses that work with my servo. Servo Motor Control - 50Hz Pulse Train Generator
We just need to define the pin to which the servo is connect, define that pin as an output, and in the loop section generate pulses with the specific duration and frequency as we explained earlier. Now let’s take a look at the Arduino code for controlling the servo motor.
See Also Arduino Brushless Motor Control Tutorial | ESC | BLDC Servo Motor Control Arduino Code