Go Down

Topic: max with a rotary encoder (Read 10 times) previous topic - next topic

gatonero

I used exactly that code from RotaryEncoder.h, RotaryEncoder.cpp and the example code from "how to run it" in RotaryEncoderTest.pde. I connected the encoderPins pinA to Arduino pin 3, encoderPins pinB to Arduino pin 4, encoderPushButton to Arduino pin 2 and common to ground, but I couldn't get any output from void loop() in RotaryEncoderTest.pde.

Than i included a Serial.println("Start"); statement in the very beginning of void setup() of RotaryEncoderTest.pde. To verify that the RotaryEncoder object gets created I included a Serial.print("Encoder Object created"); message in RotaryEncoder.cpp, which worked fine. But still I didn't get any message from RotaryEncoderTest.pde.

Please, where is my mistake? :-/
Just For Fun

Mark Mayhem

gatonero -

Check out Keith Neufeld's 'Quadrature' library.  It has solved all my encoder needs.  It allows for multiple encoders, works on overflow interrupt, and is easy to send over serial.

Here is his explanation:
http://www.neufeld.newton.ks.us/electronics/?p=248

And here is the library download:
http://www.neufeld.newton.ks.us/electronics/?page_id=249

There are examples, but if you need any more, let me know, and I'll post some code

gatonero

I testes this also before. But with the example code while compiling, I'm getting this error message:

/usr/lib/gcc/avr/4.3.0/../../../../avr/include/stdlib.h:111: error: expected `)' before 'int'

/usr/lib/gcc/avr/4.3.0/../../../../avr/include/stdlib.h:111: error: expected `)' before 'int'

In file included from /home/christoph/bin/arduino-0015/hardware/cores/arduino/WProgram.h:6,

Couldn't determine program size: avr-size: '/tmp/build18656.tmp/quadrature_two_encoders.hex': No such file
Just For Fun

Mark Mayhem

gatonero -

Oh yeah, I thought Keith was going to update.  Some libraries have the same problem in version 0013.

Adding this after all your #include statements should clear up the problem:

Code: [Select]
#undef int                    
#undef abs
#undef double
#undef float
#undef round

gatonero

Thank You Mark. that works. I will post my further experiences with the arduino-quadratur library.
Just For Fun

Go Up