Flex sensor MIDI output "stutters"

Hi, I’m currently making a MIDI controller glove, using flex sensors.

I’ve gotten it working, however the small value changes make the midi output “stutter” (please view the video). That makes the controlling inaccurate.

I would really appreciate advice on this, as its so close to completion. I feel like the answer is quite simple, but I’m new to Arduino.

Below is the code I used

#include <SPI.h>

//MIDI Settings Start
#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

#define cc_MIN 0
#define cc_MAX 127

//MIDI Settings End

int maxFinger[4];
int minFinger[4];

void setup () {
int i;
analogReference(INTERNAL); //probably just voltage
//SPI.setBitOrder(MSBFIRST);
//SPI.setClockDivider(SPI_CLOCK_DIV2);
//SPI.setDataMode(SPI_MODE3);
Serial.begin(9600);
maxFinger[0] = 0x316; //790
minFinger[0] = 0x20D; //525
maxFinger[1] = 0x1C7; //455
minFinger[1] = 0x104; //260
maxFinger[2] = 0x1C7; //455
minFinger[2] = 0xF5; //245
maxFinger[3] = 0x3FF;
minFinger[3] = 0x21C;
MIDI.begin(1); // Launch MIDI with default options
}

void loop() {
int i;
int finger[4];
for (i=0; i<4; i++) {
finger = analogRead(i);
if (finger > maxFinger*) {*
finger = maxFinger*;*

* }*
if (finger < minFinger*) {*
finger = minFinger*;*

* }*

* if (i < 3) {*
int fingerValue = map(finger, minFinger, maxFinger*, cc_MIN, cc_MAX);
_ MIDI.sendControlChange(12+i,fingerValue,1);
}
}
delay(100);
}
[/quote]
giphy (3).gif*_

A first step would be to add array indices to all finger, minFinger, and maxFinger in your loop.