Reference¶
-
class
adafruit_motor_hat.MotorHat.
AdafruitStepperMotor
(controller, num, steps=200)[source]¶ -
align_step
(reverse=False)[source]¶ Align the current step position with a full step
Parameters: reverse (bool) – run in reverse Returns: None
-
double_step
(steps=1, reverse=False)[source]¶ Double stepping, 2 coils at once
Parameters: - steps (int) – The number of steps to execute
- reverse (bool) – step in reverse
Returns: None
-
interleaved_step
(steps=1, reverse=False)[source]¶ Interleaved stepping, single stepping and interleaved stepping
Parameters: - steps (int) – The number of steps to execute
- reverse (bool) – step in reverse
Returns: None
-
micro_step
(steps=1, reverse=False)[source]¶ Microstepping
Parameters: - steps (int) – The number of steps to execute
- reverse (bool) – step in reverse
Returns: None
-
-
class
adafruit_motor_hat.MotorHat.
AdafruitMotorHAT
(addr=96, freq=1600, i2c=None, i2c_bus=None)[source]¶ -
get_motor
(num)[source]¶ Get a motor instance
Parameters: num (int) – the stepper to get 1-4 Returns: :class:`AdafruitDCMotor’
-
-
class
adafruit_motor_hat.Adafruit_PWM_Servo_Driver.
PWM
(address=64, debug=False, i2c=None, i2c_bus=None)[source]¶ Adafruit PCA9685 16-Channel PWM Servo Driver
-
setAllPWM
(on, off)[source]¶ Sets all the pwm outputs to the corresponding outputs
Parameters: - on – the portion of the PWM period in 1/4096ths of a period (0 corresponds to the start, 4096 corresponds to the end) to wait before the signal turns on
- off – the portion of the PWM period in 1/4096ths of a period (0 corresponds to the start, 4096 corresponds to the end) to wait before the signal turns off
Returns: None
-
setPWM
(channel, on, off)[source]¶ Set a single pwm channel
Parameters: - channel – the channel number from 0-15 inclusive
- on – the portion of the PWM period in 1/4096ths of a period (0 corresponds to the start, 4096 corresponds to the end) to wait before the signal turns on
- off – the portion of the PWM period in 1/4096ths of a period (0 corresponds to the start, 4096 corresponds to the end) to wait before the signal turns off
Returns: None
-
-
adafruit_motor_hat.Adafruit_PWM_Servo_Driver.
get_i2c_device
(address, i2c, i2c_bus)[source]¶ Helper method to get a device at the specified address from the I2C bus. If no i2c bus is specified (i2c param is None) then the default I2C bus for the platform will be used.
Parameters: - address (hex) – i2c address to get the handle for
- i2c – GPIO i2c class, None to use the Adafruit_GPIO.I2C class
- i2c_bus – i2c bus number, passed to busnum, none to autodetect
Returns: i2c Address