An interface for a simple, 1-track, incremental encoder.

Dependents:   AVC_20110423 incrementalencoder-pid-robot DataBus2018

Embed: (wiki syntax)

« Back to documentation index

IncrementalEncoder Class Reference

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.
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 7 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 9 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 17 of file IncrementalEncoder.cpp.

void reset (  )

Reset the tick counter.

Definition at line 22 of file IncrementalEncoder.cpp.