Max7219 + 8x8 LED Matrix
滚动显示 I ❤️ U。
算法很简单,首先定义滚动画面8x32矩阵。通过generate_8x8_matrix函数生成当前循环中应当显示的8x8矩阵,通过LedControl模块的setLed设置对应的点阵即可。
不要放太久,因为times是一个int型,并未进行溢出情况的处理。
1 #include <LedControl.h> 2 3 int DIN = 12; 4 int CS = 11; 5 int CLK = 10; 6 7 char TOTAL[8][32] = { 8 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0}, 9 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0,