#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
//ss
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 11
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

uint8_t scrollSpeed = 20;
textEffect_t scrollEffect = PA_SCROLL_LEFT;
textEffect_t scrollEffect2 = PA_SCROLL_RIGHT;

textPosition_t scrollAlign = PA_CENTER;
uint16_t scrollPause = 1500;

#define BUF_SIZE 25
char curMessage[BUF_SIZE] = { "" };
bool newMessageAvailable = true;

void setup() {
  P.begin();
  P.displayText(curMessage, scrollAlign, scrollSpeed, scrollPause, scrollEffect, scrollEffect2);
  Serial.begin(57600);
}

void loop() {
   int value=analogRead(A0);
   Serial.print("Value of the potentiometer is : ");
  Serial.println(value);
  if (P.displayAnimate()) {
    P.displayReset();
  }

  
  if(value > 0 && value < 504){
char newMessage[BUF_SIZE] = { "low" };
      strcpy(curMessage, newMessage);


  }else if(value >= 504 && value < 750 ){
    char newMessage[BUF_SIZE] = { "Mid" };
          strcpy(curMessage, newMessage);


  }else if(value >= 750){
char newMessage[BUF_SIZE] = { "High" };
      strcpy(curMessage, newMessage);


  }

  delay(10); // Adding a small delay here
}