Arduino Painless Development _LED8*8 Dot Matrix Experiment (Detailed)

2022-08-06 18:29:28

准备元件

An ugly one8*8LED点阵（16/18引脚）No registers were used in this experiment所以需要大量杜邦线

LED_8*8点阵原理图

8* 8 LED点阵共由 64 个发光二极管组成,Each LED is placed at the intersection of the row and column lines,and the corresponding behavior 1 电平,列置 0 电平,The coordinate diode is on; Light up a row in the same way：第 1 脚要接高电平,【A,B,C,D,E,F,G,H 】接低电平,The first row lights up;反之,第 a 脚接低电平,而【】1、2、3、4、5、6、7、8】接高电平,The first column lights up;

PS：The row is connected to the anode of the diode,为高电平,The column is connected to the cathode of the diode,为低电平

LED_8*8Dot matrix wiring diagram

18引脚平面示意图16引脚 for a symmetrical distribution,16Pin Plane Pin Diagram PS：The actual pins of some components can be messy,This depends on the actual pin of the component

接线部分

for convenience,I soldered on the board,The breadboard will be looser小建议 接线的时候,A row and a column are connected in a certain orderMega（See the code definition for details） PS：The diagram above roughly simulates the wiring sequence,It is not the wiring diagram of this experiment

Arduino代码部分

``````int Row[] = {30, 31, 32, 33, 34, 35, 36, 37};//Define row pins
int Column[] = {22, 23, 24, 25, 26, 27, 28, 29};//Define column pins

unsigned char Light[8][8] = //'全亮'
{
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
};

unsigned char Dark[8][8] = //'全灭'
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};

void setup() {
// The matrix code runs once:
for(int i = 0; i < 8; i++)
{
pinMode(Row[i], OUTPUT);//输出模式
pinMode(Column[i], OUTPUT);//输出模式
}
}
void loop() {
//The main code runs in a loop:
for(int i = 0; i< 100; i++)
{
Display(Light);
}
for(int i = 0; i< 100; i++)
{
Display(Dark);
}
}

void Display(unsigned char lattice[8][8])//显示函数
{
for(int r = 0; r < 8; r++)
{
digitalWrite(Row[r], LOW);
for(int c = 0; c < 8; c++)
{
digitalWrite(Column[c], lattice[r][c]);
}
delay(1);
Clear();
}
}
void Clear()//清除函数
{
for(int i = 0; i < 8; i++)
{
digitalWrite(Row[i], HIGH);
digitalWrite(Column[i], LOW);
}
}

This part is the drawing panel,You can imagine the pattern you want to draw（‘1’代表亮灯,‘0’为熄灭） 例如：

``````unsigned char bigheart[8][8] = //'爱心'
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0,
};

LOVE爱心~表白

``````int Row[] = {30, 31, 32, 33, 34, 35, 36, 37};//Define row pins
int Column[] = {22, 23, 24, 25, 26, 27, 28, 29};//Define column pins

unsigned char bigheart[8][8] = //'大心'
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0,
};

unsigned char smallheart[8][8] = //'小心'
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 1, 0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 1, 1, 1, 1, 1, 1, 0,
0, 1, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 0,
};
unsigned char U[8][8] = //'U'
{
1, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 1,
1, 1, 0, 0, 0, 0, 1, 1,
0, 1, 1, 0, 0, 0, 1, 1,
0, 0, 1, 1, 1, 1, 0, 0,
};

void setup() {
// The matrix code runs once:
for(int i = 0; i < 8; i++)
{
pinMode(Row[i], OUTPUT);//输出模式
pinMode(Column[i], OUTPUT);//输出模式
}
}
void loop() {
//The main code runs in a loop:
for(int i = 0; i< 100; i++)
{
Display(I);
}
for(int i = 0; i< 100; i++)
{
Display(L);
}
for(int i = 0; i< 100; i++)
{
Display(O);
}
for(int i = 0; i< 100; i++)
{
Display(V);
}
for(int i = 0; i< 100; i++)
{
Display(E);
}
for(int i = 0; i< 100; i++)
{
Display(U);
}
for(int i = 0; i< 100; i++)
{
Display(bigheart);
}
for(int i = 0; i < 100; i++)
{
Display(smallheart);
}
for(int i = 0; i< 100; i++)
{
Display(bigheart);
}
for(int i = 0; i < 100; i++)
{
Display(smallheart);
}
for(int i = 0; i < 100; i++)
{
Display(bigheart);
}
}

void Display(unsigned char lattice[8][8])//显示函数
{
for(int r = 0; r < 8; r++)
{
digitalWrite(Row[r], LOW);
for(int c = 0; c < 8; c++)
{
digitalWrite(Column[c], lattice[r][c]);
}
delay(1);
Clear();
}
}
void Clear()//清除函数
{
for(int i = 0; i < 8; i++)
{
digitalWrite(Row[i], HIGH);
digitalWrite(Column[i], LOW);
}
}