I can not figure out how to get this CC message to just send one time.
The message is continuously being sent out as either a 0 or 127.
This is the code i am working with.
if(touchX > 127)
{MIDI.sendControlChange(22,0,1); //needs to be sent only once
}
else
{
MIDI.sendControlChange(22,127,1); //needs to be sent only once
}
isn't there some way to say "just send once" or something to that effect?
because i want it to send the message one time per trigger.
when the value is triggered as it is it sends out the message constantly slamming my midi device with non-stop messages, rather than just the one message to turn the function on.
basically i want it to operate as if it were a button sending an on then off message.
not like: on on on on on on on on on on on on on on on on off off off off off off off off off off off off off off off off off off off off off off....
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
}
Which triggers when touchX is greater than 127, and then again only when touchX is greater than 127 and different to the previous value.