upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the DFRobot Wheel Encoder. More...
When you instantiate a class of this type, the gpio pin specified is connected to an interrupt. Whenever a low to high transition occurs on the gpio pin, the internal counter is incremented by one.
This class also includes a millisecond counter, so that you can correlate the number of counts to a time period for calculating an RPM or other value as needed.
Public Member Functions | |
synchronized void | delete () |
WheelEncoder (int pin) | |
long | getMillis () |
void | initClock () |
void | clearCounter () |
void | startCounter () |
void | stopCounter () |
long | counter () |
WheelEncoder | ( | int | pin | ) |
DFRobot Wheel Encoder sensor constructor
pin | Digital pin to use |
void clearCounter | ( | ) |
Resets the counter to 0. The counter should be stopped via stopCounter() prior to calling this function.
long counter | ( | ) |
Gets the current counter value
long getMillis | ( | ) |
Returns the number of milliseconds elapsed since initClock() was last called.
void initClock | ( | ) |
Resets the clock
void startCounter | ( | ) |
Starts the counter. This function will also clear the current count and reset the clock.
void stopCounter | ( | ) |
Stops the counter