ME 405
enc_driver.py File Reference

This file contains a class that acts as an encoder driver. More...

Classes

class  enc_driver.EncDriver
 An encoder driver object. More...
 

Namespaces

 enc_driver
 

Variables

 enc_driver.pin_E1CH1 = pyb.Pin(pyb.Pin.cpu.B6)
 The pin object connected to Encoder 1's channel 1. More...
 
 enc_driver.pin_E1CH2 = pyb.Pin(pyb.Pin.cpu.B7)
 The pin object connected to Encoder 1's channel 2. More...
 
 enc_driver.e1 = EncDriver('E1', pin_E1CH1, 1, pin_E1CH2, 2, 4, 1000, False)
 An encoder object representing the encoder attached to Motor 1. More...
 
 enc_driver.pin_E2CH1 = pyb.Pin(pyb.Pin.cpu.C6)
 The pin object connected to Encoder 2's channel 1. More...
 
 enc_driver.pin_E2CH2 = pyb.Pin(pyb.Pin.cpu.C7)
 The pin object connected to Encoder 2's channel 2. More...
 
 enc_driver.e2 = EncDriver('E2', pin_E2CH1, 1, pin_E2CH2, 2, 8, 1000, False)
 An encoder object representing the encoder attached to Motor 2. More...
 
 enc_driver.test_type = input('Running test or time test? (r/t): ')
 The test type used (running or timed) More...
 
 enc_driver.test_enc = input('Running test or time test? (A/B): ')
 The encoder selection for testing. More...
 
 enc_driver.start = utime.ticks_us()
 
 enc_driver.pos = e2.get_position('deg')
 
 enc_driver.stop = utime.ticks_us()
 
 enc_driver.run_time = utime.ticks_diff(stop,start)
 
 enc_driver.delta = e2.get_delta('deg')
 

Detailed Description

This file contains a class that acts as an encoder driver.

Author
E. Nicholson
Date
October 12, 2020

This file contains the class 'EncDriver.' This class facilitates configuring a Nucleo - L476RG to interface with an encoder.The object that this class creates correctly tracks encoder position, and recent position delta. The encoder position can also be zeroed. The file also contains code the facilitates performance testing and debugging.

The source code for this file can be found here:

https://bitbucket.org/ewnichol/me305-me405_labs/src/master/me405/me405%20Term%20Project/enc_driver.py