Smart Home Automation Forum

Full Version: [Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[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);
 

}