#include <LedControl.h>
int DIN = 12;
int CS = 11;
int CLK = 10;
byte e[8]= {0x7C,0x7C,0x60,0x7C,0x7C,0x60,0x7C,0x7C}; //E
byte d[8]= {0x78,0x7C,0x66,0x66,0x66,0x66,0x7C,0x78}; //D
byte u[8]= {0x66,0x66,0x66,0x66,0x66,0x66,0x7E,0x7E}; //U
byte c[8]= {0x7E,0x7E,0x60,0x60,0x60,0x60,0x7E,0x7E}; //C
byte eight[8]= {0x7E,0x7E,0x66,0x7E,0x7E,0x66,0x7E,0x7E}; //8
byte s[8]= {0x7E,0x7C,0x60,0x7C,0x3E,0x06,0x3E,0x7E}; //S
byte dot[8]= {0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18}; //.
byte o[8]= {0x7E,0x7E,0x66,0x66,0x66,0x66,0x7E,0x7E}; //O
byte m[8]= {0xE7,0xFF,0xFF,0xDB,0xDB,0xDB,0xC3,0xC3}; //M
LedControl lc=LedControl(DIN,CLK,CS,16);
void setup(){
lc.shutdown(0,false); //启动时,MAX72XX处于省电模式
lc.setIntensity(0,8); //将亮度设置为最大值
lc.clearDisplay(0); //清除显示
}
void loop(){
byte smile[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C};//笑脸
byte neutral[8]= {0x3C,0x42,0xA5,0x81,0xBD,0x81,0x42,0x3C};//标准脸
printByte(e);//显示8
delay(1000);//延时1秒
printByte(neutral);//显示标准脸
delay(1000);
printByte(smile);//显示标准脸
delay(1000);
lc.setLed(1,1,5,true);
}
//点阵显示函数
void printByte(byte character [])
{
int i = 0;
for(i=0;i<8;i++)
{
lc.setRow(0,i,character[i]);
}
}