Luisa Chiu Portfolio
DRV8847.Motor Class Reference

A motor class for one channel of the DRV8847. More...

Public Member Functions

def __init__ (self, pinA, pinB, channel_A, channel_B, tim)
 Initializes and returns a motor object associated wtih the DRV8847. More...
 
def set_duty (self, duty)
 Set the PWM duty cycle for the motor channel. More...
 

Public Attributes

 tim
 Variable that specifies timer number. More...
 
 channel_A
 Variable that specifies channel number corresponding to motor 1. More...
 
 channel_B
 Variable that specifies channel number corresponding to motor 2. More...
 
 duty
 Variable that defines duty cycle for PWM input. More...
 

Detailed Description

A motor class for one channel of the DRV8847.

Objects of this class can be used to apply PWM to a given DC motor.

Constructor & Destructor Documentation

◆ __init__()

def DRV8847.Motor.__init__ (   self,
  pinA,
  pinB,
  channel_A,
  channel_B,
  tim 
)

Initializes and returns a motor object associated wtih the DRV8847.

Objects of this class should not be instantiated directly. Instead create a DRV8847 object and use that to create Motor objects using the method DRV8847.motor().

Member Function Documentation

◆ set_duty()

def DRV8847.Motor.set_duty (   self,
  duty 
)

Set the PWM duty cycle for the motor channel.

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

Parameters
dutyA signed number holding the duty cycle of the PWM signal sent to the motor.

Member Data Documentation

◆ channel_A

DRV8847.Motor.channel_A

Variable that specifies channel number corresponding to motor 1.

This variable was created to generalize channel number and allow for specification in task files

◆ channel_B

DRV8847.Motor.channel_B

Variable that specifies channel number corresponding to motor 2.

This variable was created to generalize channel number and allow for specification in task files

◆ duty

DRV8847.Motor.duty

Variable that defines duty cycle for PWM input.

Duty cycle values control motor speed

◆ tim

DRV8847.Motor.tim

Variable that specifies timer number.

This variable was created to generalize timer number and allow for specification in task files


The documentation for this class was generated from the following file: