Code:
touchXOld = 0
if(touchX > 127 && touchX <> touchXOld){
touchXOld = touchX;
MIDI.sendControlChange(22,0,1); //needs to be sent only once
} else {
MIDI.sendControlChange(22,127,1); //needs to be sent only once
}
if(touchX > 127 && touchX <> touchXOld){
touchXOld = touchX;
MIDI.sendControlChange(22,0,1); //needs to be sent only once
} else {
MIDI.sendControlChange(22,127,1); //needs to be sent only once
}
Which triggers when touchX is greater than 127, and then again only when touchX is greater than 127 and different to the previous value.
ie 1 becomes 0 and 0 becomes 1