The software engineer in me couldn’t help but notice this code could be tightend up:
const int ports[] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16};
int v[16];
int next;
void setup() {
}
void loop() {
for(int i=0;i<16;i++) {
next = (analogRead(ports[i]) / 4 + v[i]) / 2;
if(v[i] != next)
usbMIDI.sendControlChange(i, next / 2, 1);
v[i] = next;
}
delay(4);
}