Smart Home Automation Forum
[arduino source code for KC868-Uair-1] WS2812 RGB LEDs blink - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-Uair (https://www.kincony.com/forum/forumdisplay.php?fid=31)
+--- Thread: [arduino source code for KC868-Uair-1] WS2812 RGB LEDs blink (/showthread.php?tid=1562)



[arduino source code for KC868-Uair-1] WS2812 RGB LEDs blink - admin - 12-30-2021

#include <FastLED.h>

#define NUM_LEDS 4
#define DATA_PIN 32
CRGB leds[NUM_LEDS];

void setup() {
    FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}

void loop() {
    leds[0] = CRGB::Blue;
    leds[1] = CRGB::Blue;
    leds[2] = CRGB::Blue;
    leds[3] = CRGB::Blue;
    FastLED.show();
    delay(2000);
    leds[0] = CRGB::Black;
    leds[1] = CRGB::Black;
    leds[2] = CRGB::Black;
    leds[3] = CRGB::Black;
    FastLED.show();
    delay(2000);
}

download arduino IDE source code file: 
.zip   Uair-LED.zip (Size: 364 bytes / Downloads: 238)

Note: install "FastLED" library online firstly.