mirror of
https://github.com/digistump/DigistumpArduino.git
synced 2025-04-27 23:29:01 -07:00
24 lines
386 B
C++
24 lines
386 B
C++
#include <WS2811.h>
|
|
DEFINE_WS2811_FN(WS2811RGB, PORTB, 1)
|
|
RGB_t rgb[1]; //1 for 1 pixel
|
|
|
|
void setup() {
|
|
|
|
pinMode(1,OUTPUT);
|
|
|
|
}
|
|
|
|
void loop() {
|
|
setPixel(0,255,0,0); //set first pixel (zero indexed) to red
|
|
updatePixels(); //show the change
|
|
}
|
|
|
|
void setPixel(i,r,g,b){
|
|
rgb[r].r=r;
|
|
rgb[g].g=g;
|
|
rgb[b].b=b;
|
|
}
|
|
|
|
void updatePixels(){
|
|
WS2811RGB(rgb, ARRAYLEN(rgb));
|
|
} |