#include <LedControl.h>
int DIN = 12;
int CS = 14;
int CLK = 27;
int ledmartix=4; //四個矩陣
int led_module=1;
byte part1[8]={0X00,0X22,0X22,0X3E,0X22,0X22,0X14,0X88};
byte part2[8]={0X00,0XE2,0X22,0X22,0XE2,0X22,0X22,0XEF};
byte part3[8]={0X00,0XFB,0X08,0X08,0XFB,0X08,0X08,0XFB};
byte part4[8]={0X00,0X3E,0X02,0X04,0X08,0X10,0X20,0X3E};
/*byte A[8]= {0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00}; //英文字母A
byte T[8]= {0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x00}; //英文字母T
byte E[8]= {0xF8,0x80,0x80,0xF8,0x80,0x80,0xF8,0x00}; //英文字母Ex2
byte Z[8]= {0xF8,0x08,0x50,0x20,0x50,0x80,0xF8,0x00}; //英文字母Z*/
byte smile[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C}; //微笑
byte love_1[8]= {0X00,0X10,0X28,0X44,0X82,0X82,0X54,0X28}; //愛心-1
byte love_2[8]= {0X00,0X10,0X38,0X6C,0XC6,0XD6,0X7C,0X28}; //愛心-2
byte love_3[8]= {0X00,0X10,0X38,0X7C,0XFE,0XFE,0X7C,0X28}; //愛心-3
byte Front[8]= {0x08,0x1c,0x3e,0x7f,0x1c,0x1c,0x1c,0x1c}; //前
byte back[8]= {0x1c,0x1c,0x1c,0x1c,0x7f,0x3e,0x1c,0x08}; //後
byte left[8]= {0x10,0x30,0x7f,0xff,0x7f,0x30,0x10,0x00}; //左
byte right[8]= {0x08,0x0c,0xfe,0xff,0xfe,0x0c,0x08,0x00}; //右
LedControl lc=LedControl(DIN,CLK,CS,ledmartix);
void setup(){
lc.shutdown(0,false); //The MAX72XX is in power-saving mode on startup
lc.shutdown(1,false);
lc.shutdown(2,false);
lc.shutdown(3,false);
lc.setIntensity(0,0); // Set the brightness to maximum value設定亮度"0~15"
lc.setIntensity(1,0);
lc.setIntensity(2,0);
lc.setIntensity(3,0);
lc.clearDisplay(0); // and clear the display
}
void loop(){
/*printByte(smile);
delay(1000);
printByte(love_1);
delay(1000);
printByte(love_2);
delay(1000);
printByte(Front);
delay(1000);
printByte(back);
delay(1000);
printByte(left);
delay(1000);
printByte(right);
delay(1000);*/
printpart(); //顯示ATEEZ
delay(2000);
clearall();
//delay(500);
printhart1();//顯示愛心1
delay(200);
clearall();
printhart2();//顯示愛心2
delay(200);
clearall();
printhart3();//顯示愛心3
delay(200);
clearall();
printhart2();//顯示愛心2
delay(200);
clearall();
printhart1();//顯示愛心1
delay(200);
clearall();
}
void printpart()
{
led_module=0;
printByte(part1);
led_module=1;
printByte(part2);
led_module=2;
printByte(part3);
led_module=3;
printByte(part4);
}
void printhart1()
{
led_module=0;
printByte(love_1);
led_module=1;
printByte(love_1);
led_module=2;
printByte(love_1);
led_module=3;
printByte(love_1);
}
void printhart2()
{
led_module=0;
printByte(love_2);
led_module=1;
printByte(love_2);
led_module=2;
printByte(love_2);
led_module=3;
printByte(love_2);
}
void printhart3()
{
led_module=0;
printByte(love_3);
led_module=1;
printByte(love_3);
led_module=2;
printByte(love_3);
led_module=3;
printByte(love_3);
}
void printByte(byte character [])
{
for(int i=0;i<8;i++)
{
lc.setRow(led_module,i,character[i]);
}
}
void clearall()
{
for(int j=0;j<4;j++)
{lc.clearDisplay(j);}
}
esp:0
esp:1
esp:2
esp:3
esp:4
esp:5
esp:6
esp:7
esp:8
esp:9
esp:10
esp:11
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:20
esp:21
esp:26
esp:33
esp:34
esp:35
esp:36
esp:37
esp:38
esp:39
esp:40
esp:41
esp:42
esp:45
esp:46
esp:3V3
esp:5V
esp:GND.1
esp:TX
esp:RX
esp:RST
esp:GND.2
matrix1:V+
matrix1:GND
matrix1:DIN
matrix1:CS
matrix1:CLK
matrix1:V+.2
matrix1:GND.2
matrix1:DOUT
matrix1:CS.2
matrix1:CLK.2
matrix2:V+
matrix2:GND
matrix2:DIN
matrix2:CS
matrix2:CLK
matrix2:V+.2
matrix2:GND.2
matrix2:DOUT
matrix2:CS.2
matrix2:CLK.2
matrix3:V+
matrix3:GND
matrix3:DIN
matrix3:CS
matrix3:CLK
matrix3:V+.2
matrix3:GND.2
matrix3:DOUT
matrix3:CS.2
matrix3:CLK.2
matrix4:V+
matrix4:GND
matrix4:DIN
matrix4:CS
matrix4:CLK
matrix4:V+.2
matrix4:GND.2
matrix4:DOUT
matrix4:CS.2
matrix4:CLK.2