I am looking for an encoder library so I tried AdaEncoder and got the following compile errors when trying the AdaEncoder example.
I need to add speed feedback to two geared robot wheel motors which turn slowly (10 rpm). I can't add an encoder on the high speed motor shafts before the gears. I need to get accurate speed based upon a fraction of a rotation. What encoder library can provide speed based on measuring the TIME BETWEEN pulses rather than just COUNTING pulses?
AdaEncoder compile errors:
MyEncoder:1: error: 'ByteBuffer' does not name a type
MyEncoder:10: error: no matching function for call to 'AdaEncoder::AdaEncoder(char, int, int)'
C:\Documents and Settings\Warren\My Documents\Arduino\libraries\AdaEncoder/AdaEncoder.h:160: note: candidates are: AdaEncoder::AdaEncoder()
C:\Documents and Settings\Warren\My Documents\Arduino\libraries\AdaEncoder/AdaEncoder.h:129: note: AdaEncoder::AdaEncoder(const AdaEncoder&)
MyEncoder:11: error: no matching function for call to 'AdaEncoder::AdaEncoder(char, const uint8_t&, const uint8_t&)'
C:\Documents and Settings\Warren\My Documents\Arduino\libraries\AdaEncoder/AdaEncoder.h:160: note: candidates are: AdaEncoder::AdaEncoder()
C:\Documents and Settings\Warren\My Documents\Arduino\libraries\AdaEncoder/AdaEncoder.h:129: note: AdaEncoder::AdaEncoder(const AdaEncoder&)
MyEncoder.ino: In function 'void loop()':
MyEncoder:24: error: 'printBuffer' was not declared in this scope
MyEncoder:26: error: cannot convert 'encoder*' to 'AdaEncoder*' in assignment
MyEncoder:28: error: 'class AdaEncoder' has no member named 'getID'
MyEncoder:29: error: 'class AdaEncoder' has no member named 'query'
MyEncoder.pde: At global scope:
MyEncoder:9: error: redefinition of 'int8_t clicks'
MyEncoder:13: error: 'int8_t clicks' previously defined here
MyEncoder:10: error: redefinition of 'char id'
MyEncoder:14: error: 'char id' previously defined here
MyEncoder.pde: In function 'void setup()':
MyEncoder:12: error: redefinition of 'void setup()'
MyEncoder:16: error: 'void setup()' previously defined here
MyEncoder.pde: In function 'void loop()':
MyEncoder:19: error: redefinition of 'void loop()'
MyEncoder:21: error: 'void loop()' previously defined here
The Adaencoder example code:
// Version 1.1: OO version
#include <ByteBuffer.h>
#include <ooPinChangeInt.h> // necessary otherwise we get undefined reference errors.
#define DEBUG
#ifdef DEBUG
ByteBuffer printBuffer(200);
#endif
#include <AdaEncoder.h>
#define ENCA_a 2
#define ENCA_b 3
#define ENCB_a A3
#define ENCB_b A4
AdaEncoder encoderA = AdaEncoder('a', ENCA_a, ENCA_b);
AdaEncoder encoderB = AdaEncoder('b', ENCB_a, ENCB_b);
int8_t clicks=0;
char id=0;
void setup()
{
Serial.begin(115200); Serial.println("---------------------------------------");
}
void loop()
{
char outChar;
while ((outChar=(char)printBuffer.get()) != 0) Serial.print(outChar);
AdaEncoder *thisEncoder=NULL;
thisEncoder=AdaEncoder::genie();
if (thisEncoder != NULL) {
Serial.print(thisEncoder->getID()); Serial.print(':');
clicks=thisEncoder->query();
if (clicks > 0) {
Serial.println(" CW");
}
if (clicks < 0) {
Serial.println(" CCW");
}
}
}
Thanks for any help!