Unable to add multiple potentiometer in Midi controller I am building a simple arduino based midi controller to send cc midi messages. However I am able to send messages only through A0 (analog input).. Any help on this will be appreciated,..

    #include &lt;MIDI.h&gt;
int pot[] = {A0,A1,A2};
int AnaPinsNum = 3;
int potIn[] = {0,0,0};
int analogValue = 0;

int lastAnalogValue[] = {0,0,0};


 void setup() 
 {
  MIDI.begin(4);
  // 115200 hairless MIDI
  Serial.begin(115200);
  int i;
  for (i = 0; i &lt; 3; i++);
 }
 void loop() {

  int i;
  for (i = 0; i &lt; AnaPinsNum; i++)

  potIn[i] = analogRead(pot[i])/8;

  // potentiometer could be too sensitive and
  // give different (+-1) values.
  // send CC only when the difference between last value
  // is more than 1
  if ((potIn[i]-lastAnalogValue[i]) &gt; 1 || (potIn[i]-lastAnalogValue[i]) &lt; -1) {
    // value changed?
    if (potIn[i] != lastAnalogValue[i]) {
      // send serial value (ControlNumber 1, ControlValue = analogValue, Channel 1)
      // more info: http://arduinomidilib.sourceforge.net/a00001.html
      MIDI.sendControlChange(1, potIn[i], 1);
      lastAnalogValue[i] = potIn[i];
    }
  }


}
Your logic is flawed here:

  int i;
  for (i = 0; i &lt; AnaPinsNum; i++)
    potIn[i] = analogRead(pot[i]) / 8;

  // potentiometer could be too sensitive and
  // give different (+-1) values.
  // send CC only when the difference between last value
  // is more than 1
  if ((potIn[i] - lastAnalogValue[i]) &gt; 1 || (potIn[i] - lastAnalogValue[i]) &lt; -1) {
    // value changed?
    if (potIn[i] != lastAnalogValue[i]) {
      // send serial value (ControlNumber 1, ControlValue = analogValue, Channel 1)
      // more info: http://arduinomidilib.sourceforge.net/a00001.html
      MIDI.sendControlChange(1, potIn[i], 1);
      lastAnalogValue[i] = potIn[i];
      }
    }


The first three lines read all three analog pins:

  int i;
  for (i = 0; i &lt; AnaPinsNum; i++)

    potIn[i] = analogRead(pot[i]) / 8;


However then, outside the loop, you are using the value of i which will now be 4, and outside the array bounds. You need to bracket the whole lot, eg.

  int i;
  for (i = 0; i &lt; AnaPinsNum; i++)
    {   // &lt;------------------------------- add this
    potIn[i] = analogRead(pot[i]) / 8;

    // potentiometer could be too sensitive and
    // give different (+-1) values.
    // send CC only when the difference between last value
    // is more than 1
    if ((potIn[i] - lastAnalogValue[i]) &gt; 1 || (potIn[i] - lastAnalogValue[i]) &lt; -1) 
      {
      // value changed?
      if (potIn[i] != lastAnalogValue[i]) 
        {
        // send serial value (ControlNumber 1, ControlValue = analogValue, Channel 1)
        // more info: http://arduinomidilib.sourceforge.net/a00001.html
        MIDI.sendControlChange(1, potIn[i], 1);
        lastAnalogValue[i] = potIn[i];
        }  // end of not same as before
      }   // end of value changed
    }   // &lt;----------------- add this





  If pot one is sending out Controller number 1 and channel number 1, 2nd pot should send Controller number 2 and channel no 2.


If I understand your question correctly:

Change:

MIDI.sendControlChange(1, potIn[i], 1);


to:

MIDI.sendControlChange(i, potIn[i], i);