This file contains a motor driver and code used to test its functionality. More...
Classes | |
| class | m_driver.MotorDriver |
| A motor driver designed to work with an H-bridge connected to a Nucleo L476RG running Micropython. More... | |
Namespaces | |
| m_driver | |
Variables | |
| m_driver.pin_nSLEEP = pyb.Pin(pyb.Pin.cpu.A15, pyb.Pin.OUT_PP) | |
| The pin object used for the H-bridge sleep pin. More... | |
| m_driver.pin_nFAULT = pyb.Pin(pyb.Pin.board.PC13, pyb.Pin.IN) | |
| The pin object used for the motor driver fault pin. More... | |
| m_driver.pin_IN1 = pyb.Pin(pyb.Pin.cpu.B4) | |
| The pin object used for the Motor 1's H-bridge input 1. More... | |
| m_driver.pin_IN2 = pyb.Pin(pyb.Pin.cpu.B5) | |
| The pin object used for the Motor 1's H-bridge input 2. More... | |
| m_driver.pin_IN3 = pyb.Pin(pyb.Pin.cpu.B0) | |
| The pin object used for the Motor 2's H-bridge input 1. More... | |
| m_driver.pin_IN4 = pyb.Pin(pyb.Pin.cpu.B1) | |
| The pin object used for the Motor 2's H-bridge input 2. More... | |
| m_driver.tim = pyb.Timer(3,freq=20000); | |
| The timer object used for PWM generation. More... | |
| m_driver.m1 = MotorDriver(pin_nSLEEP, pin_nFAULT, pin_IN1, 1, pin_IN2, 2, tim, dead_band=(-28,28), debug=True, primary=True) | |
| A motor object passing in the pins and timer. More... | |
| m_driver.m2 = MotorDriver(pin_nSLEEP, pin_nFAULT, pin_IN3, 3, pin_IN4, 4, tim, dead_band=(-25,25)) | |
| A second motor object passing in the pins and timer. More... | |
| m_driver.test_type = input('Running test, time test, motion test, fault test? (r/t/m/f): ') | |
| The test type used (running or timed) More... | |
| m_driver.test_mot = input('Which motor? (A/B): ') | |
| The motor selection for testing. More... | |
| m_driver.start = utime.ticks_us() | |
| m_driver.stop = utime.ticks_us() | |
| m_driver.run_time = utime.ticks_diff(stop,start) | |
| m_driver.duty = input('Enter a duty percentage (0-100) \n') | |
This file contains a motor driver and code used to test its functionality.
The class contained within this file is a motor driver. It connects to four Nucleo pins bound to an H-Bridge motor driver and configures them for PWM using a timer. The conditional at the end of the file allows test code to run if this file is used stand alone. The test code allows the user to run a variety of debugging tests on the driver.
The source code for this file can be found here:
https://bitbucket.org/ewnichol/me305-me405_labs/src/master/me405/me405%20Term%20Project/m_driver.py