Hello to anyone who may help me in this mess.


I've been working in a midi controller for Ableton which has the peculiarity of showing the parameters which you are controlling by display.

The trick that I used is to select a Surface Control in the preferences of Ableton, so I don't have to do the code of that part. I have chosen the Remote SL one because is the simplest controller that give you display feedback.

So my problem now is with the encoders midi send, they are not working properly.

I am sending this: usbMIDI.sendControlChange(56, valueB, 1);

valueB is a number between 1-127 which is displayed in the monitor.

As you can see in the video in the top right of ableton the blinking led is informing that its receiving midi but it only changes sometimes and not according to the value sent. I really don't know what to do next. Maybe if you have previously worked with control surfaces you know what I'm doing wrong.

Sorry for my english and thanks for your time.



Loop Code, don't pay attention to the angle stuff thats because it is a endless potentiometer:

Code:
void PotentiometerLoop() {


  if (abs((val6 + 500) - analogRead(6)) > 3) {

    //I substract 500 because the reading values where 1000 - 0
    val6 = analogRead(6) - 500;
    val5 = analogRead(5) - 500;

    //Get the Angle and I transform it to deegres because i'm not that good at radians
    angle = atan2f(val6, val5);


    if (angle < storedAngle) {

      if (valueB != 0) {

        decremento++;

        if (decremento == 3) {
          valueB--;
          
          usbMIDI.sendControlChange(56, valueB, 1);
          decremento = 0;

          Serial.print("valueB= ");
          Serial.println(valueB);
          
        }
      }
    }

    else if(angle > storedAngle) {

      if (valueB != 127) {

        incremento++;

        if (incremento == 3) {
          valueB++;
          
          usbMIDI.sendControlChange(56, valueB, 1);
          incremento = 0;

          Serial.print("valueB= ");
          Serial.println(valueB);
          
        }
      }
    }

    storedAngle = angle;

  }