I have an OLED 128x32 SSD1306 I2C display connected to an UNO via pins A5 and A4. I am using the Adafruit_GFX and SSD1306 libraries (along with SPI.h and Wire.h). I also connected a rotary encoder push switch to pin 2 and the the remaining (A/B) to pins 3/4 (with internal pull ups all set to HIGH).
When turning the rotary encoder the interrupt routine for the push switch is executed (it is not supposed to). I found that relocating the rotary A/B connections to pins 3/4 or 4/5 yielded the same result. Moving the A/B connections to pins 5/6, 6/7, or 12/13 solve the issue and the interrupt routine for the push switch is not executed when the rotary encoder is turned.
I also found that leaving the rotary encoder A/B connections to pin 3/4 and commenting out the following line:
would result in also solving the issue – turning of the encoder knob no longer incorrectly causes the rotary push button interrupt routine from running.
Is there something in the OLED libraries which is conflicting with my interrupt routine? Have others also experienced similar issues?