- /*
- 【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);
- }
复制代码
|