欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
arduino的關(guān)于音律燈的源代碼
[打印本頁]
作者:
wuhongLIN
時間:
2021-12-25 12:21
標題:
arduino的關(guān)于音律燈的源代碼
#include <FastLED.h>
int sound_value;
#define NUM_LEDS 30 //燈珠數(shù)
#define LED_PIN 2
#define ANALOG_READ 35
CRGB leds[NUM_LEDS];
void setup(){
Serial.begin(9600);
FastLED.setBrightness(30);
FastLED.addLeds<WS2812B, LED_PIN, RGB>(leds, NUM_LEDS);
}
void loop() {
sound_value = analogRead(ANALOG_READ);
if(sound_value > 2000 && sound_value < 2200){
for (int i = 0; i <= 10; i++)
leds[i] = CRGB(255, 0, 0); //五分之一的燈珠綠光
for (int j = 11; j <= NUM_LEDS; j++)
leds[j] = CRGB(0, 0, 0);
FastLED.show();
delay(15);
}
if(sound_value > 2400 && sound_value < 2600){
for (int i = 0; i <= 18; i++)
leds[i] = CRGB(0, 0, 255); //五分之二的燈珠藍光
for (int j = 19; j <= NUM_LEDS; j++)
leds[j] = CRGB(0, 0, 0);
FastLED.show();
delay(15);
}
if(sound_value > 2800 && sound_value < 3000){
for (int i = 0; i <= 26; i++)
leds[i] = CRGB(0, 125, 125); //五分之三的燈珠紫光
for (int j = 27; j <= NUM_LEDS; j++)
leds[j] = CRGB(0, 0, 0);
FastLED.show();
delay(15);
}
if(sound_value > 3200 && sound_value < 3400){
for (int i = 0; i <= 34; i++)
leds[i] = CRGB(125, 125, 0); //五分之四的燈珠黃光
for (int j = 35; j <= NUM_LEDS; j++)
leds[j] = CRGB(0, 0, 0);
FastLED.show();
delay(15);
}
if(sound_value > 3500){
for (int i = 0; i <= NUM_LEDS; i++)
leds[i] = CRGB(0, 255, 0); //全部紅光
FastLED.show();
delay(5);
}
}
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1