![]() |
Smart Car Controller
1.0
LIbrary to manage a Smart Car Robot
|
#include <MD_MotorEncoder.h>
Public Member Functions | |
Class constructor and destructor. | |
MD_MotorEncoder (uint8_t pinInt) | |
~MD_MotorEncoder (void) | |
Methods for core object control. | |
bool | begin (void) |
void | reset (void) |
void | read (uint32_t &interval, uint16_t &count, bool bReset=true) |
Core object for the MD_MotorEncoder class This class is a simple abstraction for DC motor encoder feedback.
MD_MotorEncoder::MD_MotorEncoder | ( | uint8_t | pinInt | ) |
Class Constructor.
Instantiate a new instance of the class.
The main function for the core object is to initialize the internal shared variables and timers to default values.
pinInt | The interrupt pin for the encoder. This is digital pin that support interrupts. |
MD_MotorEncoder::~MD_MotorEncoder | ( | void | ) |
Class Destructor.
Release any allocated memory and clean up anything else.
bool MD_MotorEncoder::begin | ( | void | ) |
Initialize the object.
Initialize the object data. This needs to be called during setup() to initialize new data for the class that cannot be done during the object creation.
void MD_MotorEncoder::read | ( | uint32_t & | interval, |
uint16_t & | count, | ||
bool | bReset = true |
||
) |
Read encoder values.
Returns the encoder accumulated count and the time period over which it was accumulated, and resets the two registers.
interval | variable for the time interval. |
count | variable for the accumulator count. |
bReset | if true (f=default) rset the counters, otherwise leave them as they are. |
void MD_MotorEncoder::reset | ( | void | ) |
Reset the encoder.
This sets the encoder counter back to 0 and the the time marker to 'now'.