【第二期第九周电协活动】Arduino串口的使用--与计算机交流
电子爱好者协会常规活动
THE END
4月22和23号晚自习,电子爱好者协会在一期实训楼B411由副会长白浩波教授会员学习了《Arduino驱动数码管实现0到9数字循环播放》。

下面就跟小编一起来学习arduino吧!!!
共阳数码管
arduino UNO控制板
面包板
欧姆电阻
材料准备
数码管的原理图:
数码管的引脚图:
因为在做的时候看不懂数码管的引脚图,所以自己画了一张,一般情况下有10个引脚。上面5个下面5个,每排的中间一个一般情况下是接低电平或者高电平,接高电平就是共阳极,接低电平就是共阴极。有万用表的可以用万用表测一下也是可以知道。

针脚与数码管对应表:
0:B
1:A
2:F
3:G
4:DP
5:C
6:D
7:F
3.3V:+



实现代码:
byte LEDs[10]={
B00011000,
B11011110,
B00110100,
B10010100,
B11010010,
B10010001,
B00010001,
B11011100,
B00010000,
B10010000
};
void setup() {
DDRD=B11111111;//控制输出方向
}
void loop() {
PORTD=B11111111;//控制输出数据是0或者1;
for(int i=0;i<10;i++){
PORTD=LEDs[i];
delay(1000);
}
}


眼前是金碧辉煌,美酒佳肴。
五月的花开的正好。
真正良辰美景,花好月圆。
让我们在成航的校园里创造更好的明天

获得更多成航电子爱好者协会咨询,请扫描下方二维码关注
--end--
声明:本文章由网友投稿作为教育分享用途,如有侵权原作者可通过邮件及时和我们联系删除:freemanzk@qq.com