- /*
- 【Arduino】66種傳感器模塊系列實驗(61)
- 實驗六十一: 直條8位 WS2812B 5050 RGB LED內置全彩驅動彩燈模塊
- 實驗程序之二,依次點亮不同色彩燈
- */
- #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);
- }
復制代碼
|