#include "LedControl.h"
// Pins for the MAX7219
#define DIN_PIN 5 // Data In
#define CS_PIN 6  // Chip Select
#define CLK_PIN 7 // Clock


LedControl lc = LedControl(DIN_PIN, CLK_PIN, CS_PIN, 1);

void setup() {
  //pinMode(A0,INPUT);
  //pinMode(A1,INPUT);
  lc.shutdown(0, false); // Wake up MAX7219
  lc.shutdown(1, false);
  lc.setIntensity(0, 8); // Set brightness (0-15)
  lc.clearDisplay(0);    // Clear the display

}

void loop() {
    lc.clearDisplay(0);
    int LeftLEDCounts= map(analogRead(A0), 0, 1023, 0, 31);
    for (int i = 0; i <= LeftLEDCounts; i++) {
        int row = i   / 8; // Calculate the row index
        int col = i % 8; // Calculate the column index
       lc.setLed(0,row,col,1);
    } 

    int RightLEDCounts= map(analogRead(A1), 0, 1023, 0, 31);
    for (int i = 0; i <= RightLEDCounts; i++) {
        int row = i   / 8; // Calculate the row index
        int col = i % 8; // Calculate the column index
       lc.setLed(0,row + 4,col ,1);
    }
delay(60); // Adjust the refresh rate as needed

}