Encoder on PIN A2-A3

hello, i try to conect one encoder to pins A2 AND A3, to send midi command… after a lot of reading i manage to write the following code. the problem is if i upload only this code in arduino is working super fine, but if i addopt the bellow code to other code i have i not working so good.

i assuming that encoders need interputs, to stop all the program and focus on encoder
but arduino from what i read only pins 2 ,3 can use interupts, i cant use pins 2, 3 becouse there is another encoder.

any idea how to solve the problem?? this is my code that i working super fine ALONE

#include <MIDI.h>
#include <Encoder.h>

Encoder browserEnc(A2, A3);
long positionBrowser  = -10;

void setup() {
  Serial.begin(115200); //31250

void readBrowserEnc() {

  int newpositionBrowser = browserEnc.read();
  int BrowserVal = map(newpositionBrowser, -1023, 1023, -255, 255);
  int BrowserValue;

  if (BrowserVal != positionBrowser) {

    if ((BrowserVal - positionBrowser) > 0) {
      BrowserValue = 127;
    else {
      BrowserValue = 1;
    MIDI.sendControlChange(15, BrowserValue, 1);
    positionBrowser = BrowserVal;
void loop() {
  //  readButtons();
  //  readLoopLEnc();
  //  readLoopREnc();
  //  readPots();

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code

hope i did it right this time :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.