Has anyone been able to use the encoder library properly with multiple encoders? I've been trying and for some reason both encoder objects read the same value and respond to pulses from either encoder. It seems to me like both objects are using the same position variable. I'm using inputs 2 & 8 for encoder1 and inputs 3&15 for encoder2. I've even tried writing different values to each encoder at the beginning of the program but both end up showing the second written value. I've ruled out circuit problems by commenting out the second encoder but keeping it connected to see that it no longer affects encoder1. Any help or experience with this would be much appreciated , I'm trying to use a mouse to track movement of a small robot for a robot competition in a project class.

I'm using wiring version 0019, on windows, with the wiring I/O board connected to a "shield" circuit board which just buffers all the inputs and outputs. I'm running the outputs from encoders on a mouse through comparators and then to the board. I've probed the outputs that go into the wiring board and verified that they are two sets square waves from 0 to 5V 90 degrees out of phase with their pair.I'm quite sure that it isn't a hardware malfunction because if i run either of the encoders individually(the other encoder is commented out in code, but still connected) they work perfectly fine and are unaffected by the other encoder. However if i have both encoders defined in code, but only one connected, both values will be affected by the one connected encoder, and the values will stay identical.

here is the code that I'm using to test the encoders, u can see that i begin by setting the encoders to different values, but as soon as I start, they both read 6. [code]#include <phys253.h> // ***** from 253 template file#include <LiquidCrystal.h> // ***** from 253 template file#include <Encoder.h>

Correct me if I'm wrong but aren't static member variables shared by object of the same class in c++? But i guess the code must be right since it is a library and it must have bin tested thoroughly before being released. I'm lost with this one.. i might just end up managing the second encoder without library if i can't get it to work soon.

You're right, there is a bug there, you cna give it a try by changing the line yourself in the library .h code. Then remove the .o files inside the Encoder library and compile any sketch in the Wiring environment, the library will be automatically rebuilt. Please let me know.

I've made some changes and got it to work by changing the variables to non-static and adding 4 static member functions for interrupt calls (one for each instance). Then changing the service function to non-static and having the interrupt responders call it. It could probably be accomplished in a better way, but this works without changing too much and still maintains the same api.