Lucas Murray ME 305 Portfolio
Public Member Functions | Public Attributes | List of all members
motor.Motor Class Reference

A motor class for one channel of a driver object. More...

Public Member Functions

def __init__ (self, PWM_tim, IN1_pin, IN2_pin, chA, chB)
 Initializes and returns an object associated with a DC Motor. More...
 
def setDuty (self, duty)
 Set the PWM duty cycle for the motor channel. More...
 
def killMotor (self)
 A function only used for testing to set motor speed back to zero quickly.
 

Public Attributes

 t3chA
 
 t3chB
 

Detailed Description

A motor class for one channel of a driver object.

Objects of this class can be used to apply Pulse-Width Modulation (PWM) to a given DC motor, changing the duty cycle.

Constructor & Destructor Documentation

◆ __init__()

def motor.Motor.__init__ (   self,
  PWM_tim,
  IN1_pin,
  IN2_pin,
  chA,
  chB 
)

Initializes and returns an object associated with a DC Motor.

Parameters
PWM_timThe timer associated with the board motors
IN1_pinThe first pin associated with the motor
IN2_pinThe second pin associated with the motor
chAThe first channel associated with the motor
chBThe second channel associated with the motor

Member Function Documentation

◆ setDuty()

def motor.Motor.setDuty (   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.

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