Closed underwoodblog closed 2 years ago
encoderBits = !digitalRead(pin_sw) << 2 | digitalRead(pin_clk) << 1 | digitalRead(pin_dt);
I can confirm that your Library works with Pi Pico. I have a rotary board that outputs 3V3 on switch press and I got inverted output from your library. Tried to set pin mode from PULLUP to INPUT and PULLDOWN but still reads the switch inverted. Would be nice to have a define or config to invert the switch read function. Thanks.
Hi, the switch works when +vcc goes to ground. Seems that you are requesting a function to invert that behavior, meaning the switch being triggered from ground to +vcc instead. Is this what you want?
encoderBits = !digitalRead(pin_sw) << 2 | digitalRead(pin_clk) << 1 | digitalRead(pin_dt);
Hi, I just did an update (1.2.1) that has a function called setInvertedSwitch
that allows the requested Invert Switch configuration.
Regards
Thanks! That is what I wanted, so I don't have to edit the library and have to wonder why my code doesn't work after an update of the library. Btw. great and easy to use encoder library that does what I need! Can be closed!
Regards
I can confirm that your Library works with Pi Pico. I have a rotary board that outputs 3V3 on switch press and I got inverted output from your library. Tried to set pin mode from PULLUP to INPUT and PULLDOWN but still reads the switch inverted. Would be nice to have a define or config to invert the switch read function. Thanks.