![]() |
Smart Car Controller
1.0
Library to manage a two wheeled robotic vehicle (DC Motors)
|
#include <SC_MotorEncoder.h>
Public Member Functions | |
Class constructor and destructor. | |
| SC_MotorEncoder (uint8_t pinInt) | |
| ~SC_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 SC_MotorEncoder class This class is a simple abstraction for DC motor encoder feedback.
| SC_MotorEncoder::SC_MotorEncoder | ( | uint8_t | pinInt | ) |
Class Constructor.
Instantiate a new instance of the class.
The main function for the core object is to reset the internal shared variables and timers to default values.
| pinInt | The interrupt pin for the encoder. This is digital pin that supports interrupts. |
| SC_MotorEncoder::~SC_MotorEncoder | ( | void | ) |
Class Destructor.
Release any allocated memory and clean up anything else.
| bool SC_MotorEncoder::begin | ( | void | ) |
Initialize the object.
Initialize the object data. This needs to be called during setup() to reset new data for the class that cannot be done during the object creation.
| void SC_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 registers if required.
| interval | variable for the time interval. |
| count | variable for the accumulator count. |
| bReset | if true (f=default) reset the counters, otherwise leave them as they are. |
| void SC_MotorEncoder::reset | ( | void | ) |
Reset the encoder.
This sets the encoder counter back to 0 and the the time marker to 'now'.