libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
QuadratureEncoder Class Reference

This object stores encoder ticks in a signed 4 byte int sized variable. More...

#include <quadrature_encoder.h>

Public Member Functions

bool Start (const int basePin, const int numberOfEncoders)
 Start a new cog with the encoder monitor. More...
 
void Stop (void)
 
int GetReading (const int index)
 

Detailed Description

This object stores encoder ticks in a signed 4 byte int sized variable.

This means that there is some chance of overflow the encoder is used in a single direction continuously. To calculate the maximum distance in a single direction use the following equation:

maxDistanceInMiles = (2^31)* wheelDiameterInFeet * pi / ticksPerWheelRevolution /5280

For a robot with 6" diameter wheels and 144 ticks per wheel revolution the maximum distance in a single direction is 4,436 mi.

However, for a robot with 6" diameter wheels, a 2048 tick encoder on the motor shaft and a 100:1 gearbox, the maximum distance is 3.1 miles.

Therefore, you should chose your encoder, gearbox, and wheel combination to match the precision that you need (distance per tick) while minimize the total ticks per revolution.

Copyright (c) 2013 Kenneth Bedolla (libpr.nosp@m.opel.nosp@m.ler@k.nosp@m.enne.nosp@m.thbed.nosp@m.olla.nosp@m..com)

Member Function Documentation

int QuadratureEncoder::GetReading ( const int  index)
inline
bool QuadratureEncoder::Start ( const int  basePin,
const int  numberOfEncoders 
)
inline

Start a new cog with the encoder monitor.

Parameters
basePinFirst pin of encoder 1. Second pin is basePin+1. Additional pins for other encoders are contiguous starting with basePin+2.
numberOfEncodersNumber of encoders [1..16] to monitor.
Returns
True if a cog is successfully started, false otherwise.

Here is the call graph for this function:

void QuadratureEncoder::Stop ( void  )
inline

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