PDA

View Full Version : Encoder library not working?



i8dirt
11-13-2012, 08:00 AM
Hi,

I am a newb learning the Arduino via the teensy3. I am trying to talk to a quadrature encoder. I have tried the AdaEncoder.h library which also calls the PinChangeInt.h library, but the PinChangeInt.h is not compatible with a Teensy as best as I can tell.

I have also tried the Encoder library from pjrc:
http://www.pjrc.com/teensy/td_libs_Encoder.html
This may be compatible with teensy 1 & 2 but does not seem to be compatible with teensy 3.

I made a small test program just to see if the Arduino IDE will verify and it is not compiling. Am I screwing up the syntax or has this library not been ported to teensy 3 yet?

Thanks

#include <Encoder.h>
Encoder enc(5, 6);
int encnumber=0;
void setup(){
pinMode(5,INPUT);
pinMode(6,INPUT);
}
void loop() {
encnumber = enc.read();
}

PaulStoffregen
11-21-2012, 03:32 AM
The Encoder library is being discussed on this thread:

http://forum.pjrc.com/threads/610-Teensy-3-Encoder-Lib