Ball Balancer Project
Public Member Functions | Public Attributes | List of all members
motor.Motor Class Reference

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

Public Member Functions

def __init__ (self, PWM_tim, IN1_pin, IN2_pin, motorNum)
 Initializes and returns an object associated with a DC Motor. More...
 
def set_duty (self, duty)
 Set the PWM duty cycle for the motor channel. More...
 

Public Attributes

 IN1
 
 IN2
 
 chanA
 
 chanB
 
 timch1
 
 timch2
 

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.Motor.__init__ (   self,
  PWM_tim,
  IN1_pin,
  IN2_pin,
  motorNum 
)

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().

Member Function Documentation

◆ set_duty()

def motor.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

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