#include <MD_MAX72xx.h>

// GPIO pins
#define CLK_PIN   18 // VSPI_SCK
#define DATA_PIN  23 // VSPI_MOSI
#define CS_PIN    5  // VSPI_SS

#define MAX_DEVICES 2
// #define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW 	
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW 	

// SPI hardware interface
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);


void setup()   {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");

  mx.begin();
  mx.control(MD_MAX72XX::INTENSITY, MAX_INTENSITY / 2);
  mx.clear();


  // mx.setPoint(1,8,true);
  // mx.update();
}

// mx.setPoint(y,x,true);  // y is down, x is left.

void   loop() {
  for(int y=0;y<8;y++){
     for(int x=0;x<16;x++){
        mx.setPoint(0,x,true);
        mx.update();
        delay(500);
        mx.setPoint(0,x,false);
        delay(100);
     }
  }
}