arduino 课件016 点阵屏幕
2019-12-01 本文已影响0人
Mr洋1
1 单词认识
单词 | 意思 |
---|---|
matrix | 矩阵 |
2 传感器
8*8-
内部结构
L1
C1
3 接线
line4 代码
image.png image.pngint line[6]={0,1,2,3,4,5};
int col[6]={8,9,10,11,12,13};
void setup() {
// put your setup code here, to run once:
for(int i =0;i<6;i++){
pinMode(line[i],OUTPUT);
pinMode(col[i],OUTPUT);
digitalWrite(line[i],HIGH);
digitalWrite(col[i],LOW); //先要关闭
}
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(line[3],LOW);
digitalWrite(col[0],HIGH);
}
image.png
显示我的图案
int line[6]={0,1,2,3,4,5};
int col[6]={8,9,10,11,12,13};
int appear[6][6]={ {0,0,0,0,0,0},
{0,0,0,1,0,0},
{0,0,0,0,0,0},
{1,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0}};
void setup() {
// put your setup code here, to run once:
for(int i =0;i<6;i++){
pinMode(line[i],OUTPUT);
pinMode(col[i],OUTPUT);
digitalWrite(line[i],HIGH);
digitalWrite(col[i],LOW);
}
}
void loop() {
// put your main code here, to run repeatedly:
// digitalWrite(line[3],LOW);
// digitalWrite(col[0],HIGH);
for(int i=0;i<6;i++){
//每个line
for(int j=0;j<6;j++){
//每个col
if(appear[i][j] ==1){
digitalWrite(line[i],LOW);
digitalWrite(col[j],HIGH);
delay(10);
digitalWrite(line[i],HIGH);
digitalWrite(col[j],LOW);
}
}
}
}