upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the DFRobot Wheel Encoder. More...

Detailed Description

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 ()
 

Constructor & Destructor Documentation

WheelEncoder ( int  pin)

DFRobot Wheel Encoder sensor constructor

Parameters
pinDigital pin to use

Member Function Documentation

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

Returns
counter value
long getMillis ( )

Returns the number of milliseconds elapsed since initClock() was last called.

Returns
Elapsed milliseconds
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


The documentation for this class was generated from the following file: