libpropeller
Making PropellerGCC Easier
|
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) |
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) opel ler@k enne thbed olla .com
|
inline |
|
inline |
Start a new cog with the encoder monitor.
basePin | First pin of encoder 1. Second pin is basePin+1. Additional pins for other encoders are contiguous starting with basePin+2. |
numberOfEncoders | Number of encoders [1..16] to monitor. |
|
inline |