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() {
  pinMode(blackButton, INPUT);
  pinMode(redButton, INPUT);

void loop(){

  int tempBlackState = digitalRead(blackButton);
  if(blackButtonState != tempBlackState){
    blackButtonState = tempBlackState;
    if (blackButtonState == HIGH) {       
          } else {

  int tempRedState = digitalRead(redButton);
  if(redButtonState != tempRedState){
    redButtonState = tempRedState;
    if (redButtonState == HIGH) {         
    } else {

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.


thanks, i'll toy with that