User Manual

range. The default is 180 degrees but your servo may have a smaller sweep. You can change the total angle by setting
actuation_range .
For example, to set the actuation range to 160 degrees:
Often the range an individual servo recognises varies a bit from other servos. If the servo didn't sweep the full
expected range, then try adjusting the minimum and maximum pulse widths using set_pulse_width_range(min_pulse,
max_pulse) .
To set the pulse width range to a minimum of 1000 and a maximum of 2000:
That's all there is to controlling standard servos with the PWM/Servo HAT or Bonnet, Python and ServoKit !
Continuous Rotation Servos
To control a continuous rotation servo, you must specify the channel the servo is on. Then you can control movement
using throttle .
For example, to start the continuous rotation servo connected to channel 1 to full throttle forwards:
To start the continuous rotation servo connected to channel 1 to full reverse throttle:
To set half throttle, use a decimal:
And, to stop continuous rotation servo movement set throttle to 0 :
That's all there is to controlling continuous rotation servos with the PWM/Servo HAT or Bonnet, Python and ServoKit !
Full Example Code
kit.servo[0].actuation_range = 160
kit.servo[0].set_pulse_width_range(1000, 2000)
kit.continuous_servo[1].throttle = 1
kit.continuous_servo[1].throttle = -1
kit.continuous_servo[1].throttle = 0.5
kit.continuous_servo[1].throttle = 0
© Adafruit Industries https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi Page 17 of 28