资源描述:
《Arduino程序代码及结果》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Arduino报告报告简介:做了很多实验,强化了单片机和C语言知识。有个更为直观了解。视频中虽然不太清楚,但是实验结果都达到了。实验目录:实验一:数码管显示数字:21实验简介:22程序代码:23程序部分截图:54程序效果5实验2:手动控制LED闪烁频率:51程序简介52程序代码53程序效果6实验3:串行通信控制LED灯。61功能描述62实验程序截图:73实验效果展示7实验4:串行通信一一温度传感器实例;71功能实现72程序截图:93程序效果图:9实验5:串行通信■环境光传感器101功能介绍:102程序代码:10实验6:串行通信•火焰传感器101功能介绍:10
2、2程序代码:103程序截图:11实验7:手动控制LED亮灭111功能介绍112程序代码:114效果12实验8:手动控制LED灯亮度121功能介绍122程序代码:133效果13实验9模拟量输出■灯光渐变131功能介绍132代码133程序效果:13实验一数码管显示数字:1实验简介:数码管显示0,1乙3,4,567,8,9数字,其中1,2两个数字延迟5秒。其他数字延迟[秒。voidsetup(){pinMode)3,OUTPUT);pinMode(8,OUTPUT);pinMode(2zOUTPUT);pinMode(4,OUTPUT);pinModef7,OUT
3、PUT);pinMode(9,OUTPUT);pinMode(6,OUTPUT);pinMode(5.OUTPUT);}voidloop(){digitalWritef9,HIGH);digitalWrite(8,HIGH);digitalWritef7,HIGH);digitalWritef6,HIGH);digitalWritef5,HIGH);digitalWritef4,LOW);digitalWritef3,HIGH);digitalWrite(2,HIGH);delay(1000);digitalWritef9zLOW);digitalWrite
4、f8zHIGH);digitalWritef7,HIGH);digitalWritef6,LOW);digitalWritef5,LOW);digitalWritef4,LOW);digitalWritef3,LOW);digitalWrite(2,LOW);delay(5000);digitalWrite(9,HIGH);digitalWrite(8,LOW);digitalWrite(7zHIGH);digitalWrite(6,HIGH);digitalWritef5,LOW);digitalWrite(4/HIGH);digitalWrite(3,H
5、IGH);digitalWrite(2,HIGH);delay(5000);digitalWritef9,HIGH);digitalWrite(8zHIGH);digitalWrite(7,HIGH);digitalWrite(6zHIGH);digitalWrite(5,LOW);digitalWrite(4,HIGH);digitalWritef3,HIGH);digitalWrite(2,LOW);delay(1000);digitalWrite(9zHIGH);digitalWrite)8,HIGH);digitalWrite(7,HIGH);dig
6、italWrite(6,LOW);digitalWrite(5,HIGH);digitalWrite(4,HIGH);digitalWrite)3,LOW);digitalWrite(2,LOW);delay(1000);digitalWrite)9,HIGH);digitalWrite)8,HIGH);digitalWrite)7,LOW);digitalWrite)6,HIGH);digitalWrite)5,HIGH);digitalWrite)4,HIGH);digitalWrite)3,HIGH);digitalWrite(2,LOW);delay
7、(1000);digitalWritef9,HIGH);digitalWrite(8,HIGH);digitalWritef7,LOW);digitalWritef6,HIGH);digitalWritef5,HIGH);digitalWritef4zHIGH);digitalWritef3,HIGH);digitalWrite(2,HIGH);delay(1000);digitalWrite(9,LOW);digitalWrite)8,HIGH);digitalWrite(7,HIGH);digitalWrite(6,HIGH);digitalWritef
8、5,LOW);digitalWritef4zLOW)