need help with the switching in this code

hi guys,
so i have this sketch im working on, it just has a switch to send a cc message and another switch that sends a program change.

the thing is they are momentary switches, is there a way to program it so it will hold the on value then send the off value when i press the button again?

here is the code.

#include <MIDI.h>

int blackButton = 5;
int redButton = 8;
int blackButtonState = 0;
int redButtonState = 0;

void setup() {
  MIDI.begin();
  pinMode(blackButton, INPUT);
  pinMode(redButton, INPUT);
}

void loop(){

  int tempBlackState = digitalRead(blackButton);
  if(blackButtonState != tempBlackState){
    blackButtonState = tempBlackState;
    if (blackButtonState == HIGH) {       
      MIDI.send(NoteOn,64,127,1); 
          } else {
        MIDI.send(NoteOff,64,0,1); 
    }
  }

  int tempRedState = digitalRead(redButton);
  if(redButtonState != tempRedState){
    redButtonState = tempRedState;
    if (redButtonState == HIGH) {         
      MIDI.send(PC,69,127,1); 
    } else {
      MIDI.send(PC,70,0,1); 
    }
    
  }
}

next i need to figure out how to get a rotary encoder to send all the program changes

I have not read through your code but maybe something like:

while(button == HIGH){
//send character code stuff here
}

Then while the button is pressed it will keep sending whatever it is.

Mowcius

thanks, i'll toy with that