#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);}
}