hi i have 3 slide potentiometer, when i move them up and down they are working fine, but if i move them little and then little more and little more, the potentiometer they don't respond from the first small move, they start to respond after lets say i move them 2cm in range. because i use those potentiometer like faders, i need them to be more sensitive. something i am missing in the code. i change timeout or vartherhold but is not what i was expecting.
int pot[NPOT] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
int ppotv[NPOT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
int potCState[NPOT] = {0};
int potPState[NPOT] = {0};
int potVar = 0;
int lastCcValue[NPOT] = {0};
int TIMEOUT = 50;
byte varThreshold = 8;
boolean potMoving = true;
unsigned long pTime[NPOT] = {0};
unsigned long timer[NPOT] = {0};
void readPots () {
for (int i = 0; i < NPOT; i++) {
potCState[i] = muxpots.read(pot[i]);
}
for (int i = 0; i < NPOT ; i++) {
potVar = abs(potCState[i] - potPState[i]);
if (potVar >= varThreshold) { //sets a threshold for the variance in the pot state, if it varies more than x it sends the cc message
pTime[i] = millis();
}
timer[i] = millis() - pTime[i];
if (timer[i] < TIMEOUT) {
potMoving = true;
}
else {
potMoving = false;
}
if (potMoving == true) {
int ccValue = map(potCState[i], 0, 1023, 0, 127);
if (lastCcValue[i] != ccValue) {
MIDI.sendControlChange(100 + i, map(potCState[i], 0, 1023, 0, 127), 1);
potPState[i] = potCState[i];
lastCcValue[i] = ccValue;
}
}
}