Potentiometer Send MIDI CC

On that first link, the code:-

if (filter[i] != data_send){ //if filter and data_send not equal then in theory this will only send midi data when a value is changes an not constantly.

Should be changed to:-

if (abs(filter[i] - data_send) > 1){ //if filter and data_send not equal then in theory this will only send midi data when a value is changes an not constantly.

This will allow a little bit of noise without constantly resending the MIDI

On that code you just posted you need a different variable for each analogue channel for both the value and the last value. As it is you are using the last value from the previous channel reading which is not going to work. While the code is rubbish change it to

AnalogValue0 = analogRead(0);
  //  convert to a range from 0 to 127:
  cc = AnalogValue0/8;
  // check if analog input has changed
  if (abs(lastAnalogValue0 - cc)>1 {
    MIDI.sendControlChange(16,cc,1);
    // update lastAnalogValue zero variable
    lastAnalogValue0 = cc;

AnalogValue1 = analogRead(1);
  //  convert to a range from 0 to 127:
  cc = AnalogValue1/8;
  // check if analog input has changed
  if (abs(lastAnalogValue1 - cc)>1 {
    MIDI.sendControlChange(16,cc,1);
    // update lastAnalogValue one variable
    lastAnalogValue1 = cc;

// and so on