Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
IncrementalEncoder Class Reference
An interface for a simple, 1-track, incremental encoder. More...
#include <IncrementalEncoder.h>
Public Member Functions | |
IncrementalEncoder (PinName pin) | |
Create an incremental encoder interface. | |
unsigned int | read () |
Get ticks since last call. | |
unsigned int | readTotal () |
Get total tick count since last reset. | |
unsigned int | readRise () |
Get total rise tick count. | |
unsigned int | readFall () |
Get total fall tick count. | |
unsigned int | readTime () |
Read time interval between ticks. | |
void | reset () |
Reset the tick counter. |
Detailed Description
An interface for a simple, 1-track, incremental encoder.
If using a simple reflectance sensor, then a voltage comparator circuit will be required to generate the pulsetrain. See: http://www.bot-thoughts.com/2011/03/avc-bot-wheel-encoders.html
Definition at line 10 of file IncrementalEncoder.h.
Constructor & Destructor Documentation
IncrementalEncoder | ( | PinName | pin ) |
Create an incremental encoder interface.
Increments counter at every rise and fall signal
- Parameters:
-
pin -- the pin to which a digital pulsetrain is sent
Definition at line 3 of file IncrementalEncoder.cpp.
Member Function Documentation
unsigned int read | ( | ) |
Get ticks since last call.
- Returns:
- the number of ticks since the last call to this method
Definition at line 12 of file IncrementalEncoder.cpp.
unsigned int readFall | ( | ) |
Get total fall tick count.
- Returns:
- total fall ticks
Definition at line 30 of file IncrementalEncoder.cpp.
unsigned int readRise | ( | ) |
Get total rise tick count.
- Returns:
- total rise ticks
Definition at line 25 of file IncrementalEncoder.cpp.
unsigned int readTime | ( | ) |
Read time interval between ticks.
- Returns:
- filtered time between encoder pulses
Definition at line 35 of file IncrementalEncoder.cpp.
unsigned int readTotal | ( | ) |
Get total tick count since last reset.
- Returns:
- total ticks since the last reset or instantiation
Definition at line 20 of file IncrementalEncoder.cpp.
void reset | ( | ) |
Reset the tick counter.
Definition at line 39 of file IncrementalEncoder.cpp.
Generated on Tue Jul 12 2022 14:09:28 by 1.7.2