Smart Home Automation Forum
[Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code - 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-A8S (https://www.kincony.com/forum/forumdisplay.php?fid=24)
+--- Thread: [Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code (/showthread.php?tid=1957)



[Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code - KinCony Support - 06-01-2022

[Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code

Code:
/*KC868-A8S  WS2812 RGB LED CODE*/

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel rgb_display = Adafruit_NeoPixel(130,12,NEO_GRB + NEO_KHZ800);
//The WS2812 rgb LED is connect to IO12    RGB_LED number is 1

void setup(){
  rgb_display.begin();
}

void loop(){
  /*
    void setPixelColor(uint16_t n, uint32_t c);
    uint16_t n   start from 0
*/
  rgb_display.setPixelColor((1)-1,(0xff00ff));// Set RGB_LED to Blue color
  rgb_display.setBrightness(100);
  rgb_display.show();
  delay(2000);
  rgb_display.setPixelColor((1)-1,(0xff0000));// Set RGB_LED to Blue color
  rgb_display.setBrightness(100);
  rgb_display.show();
  delay(2000);
  rgb_display.setPixelColor((1)-1,(0x00ff00));// Set RGB_LED to Blue color
  rgb_display.setBrightness(100);
  rgb_display.show();
  delay(2000);
 

}