Ive been working on this for hours and cannot get it figured out. have a 8x64 matrix and 4 buttons. each button is connected to ground, and pins 9, 8, and 7. I want to be able to press a button and have a message scroll across the matrix when I press a button. I also want to be able to press a different button and have the previous message stop and start the new message. heres my code so far, as I do not have much experience in coding and dont know where to go from here.
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CS_PIN 3
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
const int buttonPin1 = 9;
const int buttonPin2 = 8;
const int buttonPin3 = 7;
int buttonState = 0;
void setup() {
myDisplay.begin();
myDisplay.setIntensity(0);
myDisplay.displayClear();
pinMode(buttonPin1, INPUT);
myDisplay.displayText("Scrolling text", PA_CENTER, 45, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
void loop() {
buttonState = digitalRead(buttonPin1);
myDisplay.displayAnimate();
if (buttonState == HIGH) {
myDisplay.displayText("Scrolling text", PA_CENTER, 45, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
}