Controlling a 16 x 32 LED Matrix with a Foot Pedal

Hey All!

I am wiring my arduino to display a message when I toggle a foot pedal I have (see parts list below) and I am running into a problem. When I press down the pedal the it flickers many colors and then displays the correct information, and when I let go it leaves several pixels illuminated. Ideally the display would simply show the correct text when pressed (no flickering) and when I let go it should display nothing. Below is my current code, and the products I am using, and a picture of the illuminated pixels (when it should be blank)

Here are my parts:
Foot switch: https://www.adafruit.com/products/423?gclid=Cj0KEQjwrqieBRCln82Rgufz7I0BEiQAPNjAI-D8v2hwsdelQRqipmDl_72F4VeBL6WobRdr1ILeqiYaAhuU8P8HAQ
LED Matrix: https://www.adafruit.com/products/420?gclid=Cj0KEQjwrqieBRCln82Rgufz7I0BEiQAPNjAIxB1bQIS4KzTaHY3s-iIE-uL-d54DetrMDK-t9yNYeMaAjej8P8HAQ

Here is what my sign looks like when nothing is pressed:

Code:

#include <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library

#define CLK 8  // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE  9
#define A   A0
#define B   A1
#define C   A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);


void setup() {

  matrix.begin();
  pinMode(10, INPUT_PULLUP);
  
  }

void loop() {
  if(digitalRead(10) == HIGH) {
      
  // fill the screen with 'black'
  
  matrix.setCursor(1, 0);   // start at top left, with one pixel of spacing
  matrix.setTextSize(1);    // size 1 == 8 pixels high
  
  // print each letter with a rainbow color
  matrix.setTextColor(matrix.Color333(7,0,0));
  matrix.print('O');
  matrix.setTextColor(matrix.Color333(7,0,0)); 
  matrix.print('N');
  matrix.setTextColor(matrix.Color333(7,0,0));
  matrix.print('T');
  matrix.setTextColor(matrix.Color333(7,0,0)); 
  matrix.print('H');
  matrix.setTextColor(matrix.Color333(7,0,0));  
  matrix.print('E');
  
  matrix.setCursor(1, 9);   // next line
  matrix.setTextColor(matrix.Color333(7,0,0)); 
  matrix.print('P');
  matrix.setTextColor(matrix.Color333(7,0,0)); 
  matrix.print('H');
  matrix.setTextColor(matrix.Color333(7,0,0));
  matrix.print('O');
  matrix.setTextColor(matrix.Color333(7,0,0)); 
  matrix.print("N");
  matrix.setTextColor(matrix.Color333(7,0,0)); 
  matrix.print("E");
  }
  else {
  matrix.fillScreen(0);
  }
}

Thank you for any help, this little snag has been so annoying!

Flickering most likely caused by switch bounce. You need a debounce routine.
Not sure about the row showing, might be same thing as the flicker.
Try a delay after the matrix.fillScreen(0);