Hi Dennis,
thanks for the question, you've uncovered an issue with the way mozziAnalogRead() currently works.
mozziAnalogRead(channel) retrieves the reading from an array which holds one reading for each channel, and then puts the channel you specify onto a stack to be read in the background, returning with an interrupt instead of wasting processor time waiting in a loop, each time updateControl() is called.
So when you use the same channel twice in updateControl(), you will be retrieving the same reading twice from the array.
There are a couple of workarounds.
One option is to change the pot only once each updateControl(). That will keep the efficiency of mozziAnalogRead(), but make longer intervals between your readings as you cycle through your multiplexed pots one at a time.
Or you can edit MozziGuts.cpp so you can use ordinary analogRead().
Look for:
static void updateControlWithAutoADC()
{
updateControl();
adcStartReadCycle();
}
and comment out adcStartReadCycle();
In the same file, find
void startMozzi(int control_rate_hz)
and comment out setupMozziADC() in that function. That will now prevent the ADC interrupt being configured.
You can then use setupFastAnalogRead() in your setup() to get faster conversion times for ordinary analogRead().
Maybe it should become a Mozzi config option for situations like yours...
I hope that helps.
TIm