39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
from time import sleep
|
||
from adafruit_servokit import ServoKit
|
||
|
||
kit = ServoKit(channels=16)
|
||
|
||
# Control the minimum and maximum range of the servo.
|
||
# min_pulse (int) – The minimum pulse width of the servo in microseconds.
|
||
# max_pulse (int) – The maximum pulse width of the servo in microseconds.
|
||
kit.servo[0].set_pulse_width_range(500, 2500)
|
||
|
||
# Pulse width expressed as fraction between 0.0 (`min_pulse`) and 1.0 (`max_pulse`).
|
||
# For conventional servos, corresponds to the servo position as a fraction
|
||
# of the actuation range. Is None when servo is disabled (pulsewidth of 0ms)
|
||
# kit.servo[0].fraction = 0.5
|
||
|
||
# property angle: float | None
|
||
# The servo angle in degrees. Must be in the range 0 to actuation_range.
|
||
# Is None when servo is disabled.
|
||
kit.servo[0].angle = 180
|
||
|
||
# property throttle: float
|
||
# How much power is being delivered to the motor.
|
||
# Values range from -1.0 (full throttle reverse) to 1.0 (full throttle forwards.)
|
||
# 0 will stop the motor from spinning.
|
||
# kit.continuous_servo[0].throttle = 1
|
||
|
||
# property actuation range: float | None
|
||
# The servo angle in degrees. Must be in the range 0 to actuation_range.
|
||
# Is None when servo is disabled
|
||
#kit.servo[0].actuation_range = 120
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|