So, I am making a new kind of instrument and your MUX and accompanying code is just what I am looking for. My question about the code is more of a theoretical one that a practical one. In your code, you loop through the First MUX taking just the analogRead. You then loop through the Second MUX taking just the analogRead…and so on. Is there a particular reason that you did it that way rather that the code below.
for (int i=0; i<16; i++)
mux0array[i] = analogRead(0);
mux1array[i] = analogRead(1);
mux2array[i] = analogRead(2);
Would the code I provided not be more performant? Perhaps your code helps prevent analog cross talk? Or is more performant for some reason I do not understand? Honest question here.