分享

Fade 呼吸燈

int led = 9;         
int brightness = 0;    
int fadeAmount = 5;  
void setup() {
 pinMode(led, OUTPUT);
}
void loop() {
 analogWrite(led, brightness);
 brightness = brightness + fadeAmount;
 if (brightness <= 0 || brightness >= 255) {
   fadeAmount = -fadeAmount;
 }
 delay(10);
#Arduino 
分類:科技

評論
上一篇
  • 下一篇
  • 更多文章
    載入中... 沒有更多了