#include <LedControl.h>
//定义MAX7219的引脚
int DIN = 11;
int CS = 10;
int CLK = 13;
LedControl lc = LedControl(DIN, CLK, CS, 1);
//定义微笑表情的位图
byte smiley[8] = {
B00000000,
B00000000,
B01100110,
B01100110,
B00000000,
B01000010,
B00111100,
B00000000
};
void setup() {
//初始化MAX7219
lc.shutdown(0, false);
lc.setIntensity(0, 8);
lc.clearDisplay(0);
}
void loop() {
//显示微笑表情
for (int row = 0; row < 8; row++) {
lc.setRow(0, row, smiley[row]);
}
delay(2000);
//清空LED点阵
lc.clearDisplay(0);
delay(1000);
}