Matthew Tagupa's ME 405 Labs and Term Project
MotorDriver.py File Reference

Classes

class  MotorDriver.MotorDriver
 A motor driver object. More...
 

Namespaces

 MotorDriver
 

Variables

 MotorDriver.pin_EN_A = pyb.Pin.cpu.A10
 
 MotorDriver.pin_IN1_A = pyb.Pin.cpu.B4
 
 MotorDriver.pin_IN2_A = pyb.Pin.cpu.B5
 
int MotorDriver.timer_number_A = 3
 
int MotorDriver.freq = 20000
 
 MotorDriver.moeA = MotorDriver(pin_EN_A, pin_IN1_A, pin_IN2_A, timer_number_A, freq)
 

Detailed Description

The motor driver was built connecting a X-NUCLEO-IHM04A1 motor driver platform and a NUCLEO-L476RG. The motor was connected to the A ports in the IHM04A1 along with connecting a 12V power source to port B. The program was coded in python and uses Thonny to interact between the code and the microcontroller.

The user will be responsible for designating and defining the pins (EN, IN1, and IN2), designating the timer channel, and designating a frequency. The example in the main portion of this code gives an example of how to implement these designations. After connecting the motors to the correct ports and defining the module with the "MotorDriver" class, the user can then activate or deactivate the motor by using the enable and disable methods as well as set a pulse width module (PWM) value for the motor.

Author
Matthew Tagupa
Date
May 21, 2020