0% found this document useful (0 votes)
416 views1 page

Pixel Led ws2811 Arduino Tutorial - Arduino Pixel Led

Uploaded by

SCEKAPS12 NPCIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
416 views1 page

Pixel Led ws2811 Arduino Tutorial - Arduino Pixel Led

Uploaded by

SCEKAPS12 NPCIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

22/10/2021, 03:54 pixel led ws2811 Arduino tutorial | Arduino pixel led

// [Link]
#include <Adafruit_NeoPixel.h>
#define PIN 2 // input pin Neopixel is attached to
#define NUMPIXELS 12 // number of neopixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB +
int delayval = 100; // timing delay in milliseconds
int redColor = 0;
int greenColor = 0;
int blueColor = 0;
void setup() {
// Initialize the NeoPixel library.
[Link]();
}
void loop() {
setColor();
for (int i=0; i < NUMPIXELS; i++)
{
// [Link] takes RGB values, from 0,0,0 up to 255,255,255
[Link](i, [Link](redColor, greenColor, blueColor)
// This sends the updated pixel color to the hardware.
[Link]();
// Delay for a period of time (in milliseconds).
delay(delayval);
}
}
// setColor()
// picks random values to set for RGB
void setColor(){
redColor = random(0, 255);
greenColor = random(0,255);
blueColor = random(0, 255);
}

[Link] 1/1

You might also like