Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code
#1
Lightbulb 
[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);
 

}


Attached Files
.zip   WS2812-RGB_LED.zip (Size: 871 bytes / Downloads: 263)
Reply


Forum Jump:


Users browsing this thread: