|
- /*
- 【Arduino】66種傳感器模塊系列實(shí)驗(yàn)(61)
- 實(shí)驗(yàn)六十一: 直條8位 WS2812B 5050 RGB LED內(nèi)置全彩驅(qū)動(dòng)彩燈模塊
- 實(shí)驗(yàn)程序之二,依次點(diǎn)亮不同色彩燈
- */
- #include <FastLED.h>
- #define LED_PIN 6
- #define NUM_LEDS 8
- CRGB leds[NUM_LEDS];
- void setup() {
- FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
-
- }
- void loop() {
-
- leds[0] = CRGB(255, 0, 0);
- FastLED.show();
- delay(500);
-
- leds[1] = CRGB(0, 255, 0);
- FastLED.show();
- delay(500);
-
- leds[2] = CRGB(0, 0, 255);
- FastLED.show();
- delay(500);
-
- leds[3] = CRGB(150, 0, 255);
- FastLED.show();
- delay(500);
-
- leds[4] = CRGB(255, 200, 20);
- FastLED.show();
- delay(500);
-
- leds[5] = CRGB(85, 60, 180);
- FastLED.show();
- delay(500);
-
- leds[6] = CRGB(50, 255, 20);
- FastLED.show();
- delay(500);
- leds[7] = CRGB(150, 50, 60);
- FastLED.show();
- delay(500);
- }
復(fù)制代碼
|
|