Hy!
I've done some tests with the encoder libary on an Arduino Micro and everything worked perfectly.
However, I have now upgraded to an Arduino Due and I'm not able to get it working there.
It seems that somehow the pullup-resistors don't work. Because when the encoder is in in a state where both pins are floating, interrupts happen constantly and the value increases rapidly.
When the encoder is in a state where both pins are tied to ground, everything is fine (no unwanted interrupts).
I've also tried the following code and it works as expected:
The function "testfunc" is called when the pin is connected to ground and when floating there is a constant 3.3 volts.
After initializing an encoder at two pins, their voltage is somewhere between 0 and 3.3 Volts when floating.
Does somebody have an idea what's causing that and how it can be fixed?
I've done some tests with the encoder libary on an Arduino Micro and everything worked perfectly.
However, I have now upgraded to an Arduino Due and I'm not able to get it working there.
It seems that somehow the pullup-resistors don't work. Because when the encoder is in in a state where both pins are floating, interrupts happen constantly and the value increases rapidly.
When the encoder is in a state where both pins are tied to ground, everything is fine (no unwanted interrupts).
I've also tried the following code and it works as expected:
Code:
void setup() {
pinMode(12, INPUT_PULLUP);
attachInterrupt(12, testfunc, CHANGE);
}
After initializing an encoder at two pins, their voltage is somewhere between 0 and 3.3 Volts when floating.
Does somebody have an idea what's causing that and how it can be fixed?