项目8(任务序号11)利用四位数码管实现动态扫描显示
本篇主要是帮助大家理解视觉暂留效应以及体会74HC595的芯片的用途。
实践任务一 探究视觉暂留现象
1、电路图
2、示例程序
int del =100;/设置延时,100毫秒
void setup ()
{
pinMode(8,OUTPUT);/设置arduino的输出端口
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
void loop()
{
digitalWrite(8,HIGH);/设置arduino引脚的输出电压为高电平
delay(del);
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
delay(del);
digitalWrite(9,LOW);
digitalWrite(10,HIGH);
delay(del);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
delay(del);
digitalWrite(11,LOW);
}
```
int del =100;/设置延时,100毫秒
void setup ()
{
pinMode(8,OUTPUT);/设置arduino的输出端口
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
void loop()
{
digitalWrite(8,HIGH);/设置arduino引脚的输出电压为高电平
delay(del);
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
delay(del);
digitalWrite(9,LOW);
digitalWrite(10,HIGH);
delay(del);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
delay(del);
digitalWrite(11,LOW)
3、调节延迟时间,探究视觉暂留现象
实践任务二 利用74HC595实现多个LED灯的动态显示
1、电路图
2、示例程序
```
int big =2;
int push =3;
int datain =4;
void setup(){
pinMode(big,OUTPUT);
pinMode(push,OUTPUT);
pinMode(datain,OUTPUT);
}
int i = 0;
void loop(){
int appear[11][16]={
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}};
digitalWrite(big,LOW);
for(int j=0;j<16;j++){
digitalWrite(push,LOW);
digitalWrite(datain,appear[j]);
digitalWrite(push,HIGH);
}
digitalWrite(big,HIGH);
if(i==10){
i=0;
}else{
i++;
}
delay(1000);
}
```
3、实验结果
反思总结
关于学习
Arduino是一个很神奇的东西,虽然探究过程艰辛,但万事开头难,革命尚未成功,同志仍需努力
关于合作
在困难面前,合作学习确实高效,也让人心安,当团队每个人都有自己擅长的东西并合作融洽时,效率还是很高的。
关于芯片
话不多说,芯片质量堪忧。
关于错误排查
芯片多了,排查起来就比较麻烦,要一层一层排查故障,成功需要耐心!