求LED切换夜灯和呼吸灯的集合代码
如何在编出LED切换等的基础上将呼吸灯加进去?/*
Exploring Arduino - Code Listing 2-3: LED Fade Sketch
http://www.exploringarduino.com/content/ch2
Copyright 2013 Jeremy Blum ( http://www.jeremyblum.com )
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License v3 as published by
the Free Software Foundation.
*/
const int LED=9; //define LED for Pin 9
void setup()
{
pinMode (LED, OUTPUT); //Set the LED pin as an output
}
void loop()
{
for (int i=0; i<256; i++)
{
analogWrite(LED, i);
delay(10);
}
for (int i=255; i>=0; i--)
{
analogWrite(LED, i);
delay(10);
}
}
如何将以上两个代码合在一起做出一个可以在切换LED灯同时让LED灯拥有呼吸灯的状态? 下载一个SCoop的库,然后做两个线程。。:lol yoyojacky 发表于 2015-6-29 00:04
下载一个SCoop的库,然后做两个线程。。
高手果然在人间 我也是菜鸟,大家多互相交流哦。
页:
[1]