#include <MD_MAX72xx.h>
#define MAX_DEVICES 16
static const unsigned char bitmap_bytes[] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc0, 0x00,
0x00, 0x00, 0xc0, 0x00,
0x00, 0x00, 0xc0, 0x00,
0x00, 0x01, 0x80, 0x00,
0x00, 0x02, 0x80, 0x00,
0x00, 0x07, 0xc0, 0x00,
0x00, 0x0f, 0xc0, 0x00,
0x00, 0x0f, 0xc0, 0x00,
0x00, 0x0e, 0xc0, 0x00,
0x00, 0x06, 0xc0, 0x00,
0x00, 0x03, 0xc0, 0x00,
0x00, 0x03, 0x80, 0x00,
0x00, 0x03, 0x80, 0x00,
0x00, 0x03, 0x80, 0x00,
0x00, 0x07, 0x80, 0x00,
0x00, 0x0c, 0xc0, 0x00,
0x00, 0x08, 0x40, 0x00,
0x00, 0x08, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x20, 0x00,
0x00, 0x10, 0x20, 0x00
};
const int maxX = 32;
const int maxY = 7;
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
#define VERT_PIN A0
#define HORZ_PIN A1
#define SEL_PIN 2
MD_MAX72XX mx = MD_MAX72XX(MD_MAX72XX::PAROLA_HW, CS_PIN, MAX_DEVICES);
void setup() {
mx.begin();
mx.control(MD_MAX72XX::INTENSITY, MAX_INTENSITY / 2);
mx.clear();
pinMode(VERT_PIN, INPUT);
pinMode(HORZ_PIN, INPUT);
pinMode(SEL_PIN, INPUT_PULLUP);
}
void led_control(int x,int y,bool z)
{
int yy,xx;
yy=y%8;
xx=x+32*(y/8);
mx.setPoint(yy,xx,z);
}
void led_control_1(int num,char z)
{
int start_x,start_y;
start_x=((4-num%4)-1)*8;
start_y=num/4;
for(int i=0;i<8;i++)
{
led_control(start_x+i,start_y,z&(0x01<<i));
}
}
// the loop function runs over and over again forever
void loop() {
for(int i=0;i<128;i++)
{
led_control_1(i,bitmap_bytes[i]);
// led_control(15,15,true);
}
mx.update();
delay(100);
}