05-06-2022, 03:28 AM
(This post was last modified: 05-06-2022, 03:29 AM by KinCony Support.)
[Arduino IDE demo source code for KC868-SERVER]--#05-WS2812B LED_code
Install "Adafruit_NeoPixel"first
Code:
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel rgb_display_4 = Adafruit_NeoPixel(5,4,NEO_GRB + NEO_KHZ800);
// LED numbers is 5 led connect to IO4
void setup(){
rgb_display_4.begin();
}
void loop(){
rgb_display_4.setPixelColor((1)-1, (0xff0000)); //LED 1 RED
rgb_display_4.setPixelColor((2)-1, (0x3333ff)); //LED 2 BLUE
rgb_display_4.setPixelColor((3)-1, (0xffff33)); //LED 3 YELLOW
rgb_display_4.setPixelColor((4)-1, (0x33ff33)); //LED 4 GREEN
rgb_display_4.setPixelColor((5)-1, (0xcc33cc)); //LED 5 PURPLE
rgb_display_4.show();
}