#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

MD_Parola display = MD_Parola(MD_MAX72XX::PAROLA_HW, 10, 10);

int16_t intensity = 0;
 
void setup() 
{
  Serial.begin(115200);
  display.begin();
  display.setIntensity(intensity);
  display.displayClear();
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  display.displayText("MD Moradul Siddique, CSE, JUST", PA_LEFT, 150, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
 
void loop() 
{  
  int16_t speed = map(analogRead(A0), 0, 1023, 150, 10);
  int16_t brightness = map(analogRead(A1), 0, 1023, 0, 15);

  if (brightness != intensity){
    display.setIntensity(brightness);
    intensity = brightness;
  }
  if (speed != display.getSpeed()){
    display.setSpeed(speed);
  }
  if (display.displayAnimate()) {
    display.displayReset();
  }
 
}