Ardunio_Case_5_breath_light
来源:互联网 发布:网络直播的发展趋势 编辑:程序博客网 时间:2024/05/16 09:52
breath light
上面的这个链接讲的很好。
int ledPin = 10; void setup() { // put your setup code here, to run once: pinMode(ledPin, OUTPUT);}void loop() { // put your main code here, to run repeatedly: fadeOn(1000,5); fadeOff(1000,5);}void fadeOn(unsigned int time, int increment){ for(byte value = 0; value< 255; value += increment){ analogWrite(ledPin,value); //采用PWM pulse Width Modulation 来实现模拟信息的输出 delay(time/(255/increment)); //通过函数获得的两个变量time 和 increment 来获取LED灯的延迟 } } void fadeOff(unsigned int time, int decrement){ for(byte value = 255; value > 0; value-= decrement){ analogWrite(ledPin, value); delay(time/(255/decrement)); } }
0 0
- Ardunio_Case_5_breath_light
- 如何去除打开几个WORD文件在一个窗口
- No enclosing instance of type xxx is accessible
- 算法(第四版)学习笔记之java实现快速排序
- 黑马程序员——String类常见的操作方法
- Codeforces Round #313 (Div. 2)D. Equivalent Strings(字符串)
- Ardunio_Case_5_breath_light
- Android Studio最常用快捷键以及如何把快捷键放到桌面壁纸上
- SQLite 插入大量数据慢的解决方法
- 代悲白头翁
- LCA与RMQ
- git常用命令
- 如何kill一个 defunct 进程
- eclipse常用的快捷键
- ZOJ - 1847 The Trip(奇葩诡异坑题)