A servo motor is a rotary actuator that allows for precise control of angular position, velocity, and acceleration. It consists of a suitable motor coupled to a sensor for position feedback.
evive has two dedicated servo motor outputs pins.
Servo is controlled on the concept of PWM (Pulse Width Modulation). The refresh interval (the minimum time to refresh servos in microseconds) is 20000, which means that the servo is refreshing at a frequency of 50Hz. For most of the servos, a certain range of PWM correspond to the range of angle servo can rotate. Minimum pulse width is the shortest time for the pulse has been HIGH and maximum pulse width is the longest time for which the pulse is HIGH. Hence if the range of motor angular position is from 0 to 180, the minimum pulse width corresponds to 0 and maximum pulse width corresponds to 180.
Signal pin of servo 1 is connected to digital pin 44 and servo 2 is connected to digital pin 45.
Which can be used as SERVO1_ATTACH and SERVO2_ATTACH.
There is a servo library which can be used to control the servo motor. The available functions are provided in the table below:
The sample code is given below which uses the library:
In this example we are controlling servo motor using inbuilt potentiometer.