Hi hat controller sketch

Thanks for responding, I’m not experienced with code at all, I was able to get all the drum pads to work just by pasting this block of code over and over and changing the pin and note numbers. I don’t understand why the code works or how it can be somewhat velocity sensitive using the ‘‘while’’ statement but it works unless I can find a better way. I was able to get the FSR pedal to trigger 1 note by changing (val > 600) to (val < 10) but I’m not sure how to get it to trigger the second note which is triggered when the pedal is tapped down lightly and very quickly released mimicking a mechanical hi hat splash.
I’m grateful for any idea how to accomplish this.

{

int val;
val = analogRead(A0);
if (val > 600) { // if it is greater than the threshold
noteOn(0, 50, 127); // send a note on message the 68 is the pitch of the note
MidiUSB.flush(); // send the MIDI message
while (analogRead(A0) > 600) { } // wait here until the signal has dropped
noteOff(0, 50, 127); // send the note off message
MidiUSB.flush(); // send the MIDI message
}

If there’s a better way to write this, feel free to make corrections or suggestions.