RomiMotor module

Houses RomiMotor class

Adopted from ME405 Lab 0x04

Jack Miller and Casey Pickett 7 November 2023

TI DRV8838 motor driver

class RomiMotor.RomiMotor(PWM_tim, SLP_pin, PH_pin, PH_channel, DIR_pin)

Bases: object

A driver class for one channel of the L6206.

Objects of this class can e used to apply PWM to a given DC motor on one channel of the L6206 from ST Microelectronics

Parameters:
  • PWM_tim (pyb.Timer) – PWM timer for motor.

  • SLP_pin (pyb.Pin) – SLP pin acts as an enable/disable pin.

  • PH_pin (pyb.Pin) – PH pin corresponds to PWM signal.

  • PH_channel (int) – PH channel number for PWM signal.

  • DIR_pin (pyb.Pin) – Direction Pin.

disable()

Enable one channel of the L6206.

Sets the enable pin associated with one channel of the L6206 high in order to enable that channel of the motor driver

enable()

Enable one channel of the L6206.

Sets the enable pin associated with one channel of the L6206 high in order to enable that channel of the motor driver

set_duty(duty)

Set the PWM duty cycle for the DC motor.

This method sets the duty cycle to be sent to the L6206 to a given level. Positive values cause effort in one direction, negative values in the opposite direction.

Parameters:

duty (int) – Duty cycle from -100 to 100%.