36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
import math
|
||
from adafruit_servokit import ServoKit
|
||
|
||
kit = ServoKit(channels=16)
|
||
MIN_PULSE = 400 # Defines angle 80, for current PID setup -- 550
|
||
MAX_PULSE = 2500 # Defines angle 100, for current PID setup -- 2450
|
||
kit.servo[0].set_pulse_width_range(MIN_PULSE, MAX_PULSE)
|
||
# kit.servo[0].set_pulse_width_range(MIN_PULSE, MAX_PULSE)
|
||
# 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 = 90
|
||
|
||
|
||
# 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 = 0.5
|
||
|
||
# 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
|