ME 305 Group 6 Documentation
Public Member Functions | List of all members
motor_03.Motor_03 Class Reference

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

Public Member Functions

def __init__ (self, pyb.Timer PWM_tim, pyb.Pin IN1_pin, pyb.Pin IN2_pin, int timChannel1, int timChannel2)
 Initializes and returns an object associated with a DC Motor. More...
 
def set_duty (self, duty)
 Set this PWM duty cycle for the motor channel. 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 motor_03.Motor_03.__init__ (   self,
pyb.Timer  PWM_tim,
pyb.Pin  IN1_pin,
pyb.Pin  IN2_pin,
int  timChannel1,
int  timChannel2 
)

Initializes and returns an object associated with a DC Motor.

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() Must specify correct timer channel to work with IN2_pin

Parameters
PWM_timPasses in a timer object for generating the PWM signal.
IN1_pinThe first input pin for this motor.
IN2_pinThe second input pin for this motor.
timChannel1The first timer channel for the motor, attached to IN1_pin
timChannel2The second timer channel for the motor, attached to IN2_pin

Member Function Documentation

◆ set_duty()

def motor_03.Motor_03.set_duty (   self,
  duty 
)

Set this 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 PWN signal sent to the motor

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