Datasheet
Be sure you've turned on or plugged in the external 5V power supply to the PCA9685 board too!
Now in the Python REPL as above with the led, save a variable for its channel:
Servos typically operate at a frequency of 50 hz so update pca accordingly.
Now that the PCA9685 is set up for servos lets make a Servo object so that we can adjust the servo based on angle
instead of duty_cycle.
By default the Servo class will use actuation range, minimum pulse-width, and maximum pulse-width values that should
work for most servos. However check the Servo class documentation for more details on extra parameters to
customize the signal generated for your servos.
With Servo, you specify a position as an angle. The angle will always be between 0 and the actuation range given
when Servo was created. The default is 180 degrees but your servo might have a smaller sweep--change the total
angle by specifying the actuation_angle parameter in the Servo class initializer above.
Now set the angle to 180, one extreme of the range:
servo_channel = pca.channels[0]
pca.frequency = 50
import adafruit_motor.servo
servo = adafruit_motor.servo.Servo(servo_channel)
servo.angle = 180
© Adafruit Industries https://learn.adafruit.com/16-channel-pwm-servo-driver Page 25 of 29










