#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
#define MAX_DEVICES 1
MD_Parola myDisplay = MD_Parola(MD_MAX72XX::FC16_HW, CS_PIN, MAX_DEVICES);
int scrollSpeed = 100;
char text[8] = ""; // Define an array to hold the text
void setup() {
myDisplay.begin();
myDisplay.displayText(text, PA_LEFT, scrollSpeed, 0, PA_SCROLL_RIGHT);
}
void loop() {
int sensorReading = analogRead(A0);
int range = map(sensorReading, 0, 1023, 0, 3);
switch (range) {
case 0:
strcpy(text, "low"); // Copy the string into the text array
break;
case 1:
strcpy(text, "medium");
break;
case 2:
strcpy(text, "upper");
break;
case 3:
strcpy(text, "high");
break;
default:
Serial.println("Invalid range");
break;
}
delay(1);
myDisplay.displayAnimate(); // Display the updated text on the LED matrix
}