// you have to include the library
# include <Adafruit_NeoPixel.h>
// and where the strip is hooked up on the Arduino
# define PIXEL_PIN 6
// how many pixels on the strip?
# define N_LEDS 20
// make the neopixel object.
// here I use NEO_GRB + NEO_KHZ800. that's typical, but must match the strip you have
// it is called myStrip. Most just call it "strip"
Adafruit_NeoPixel myStrip(N_LEDS, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// in your setup, make one call to the begin method
myStrip.begin();
}
void loop() {
// in your code, change any pixel's color
// pixel number: NN from 0 to the end of the strip (NLEDS - 1) in this example 0..19
// red level: redBrightness 0 off to - 255 full brightness red
// green level: greenBrightness
// red level: blueBrightness
int NN = 4; // some pixel
byte redBrightness = 128; // half bright red +
byte greenBrightness = 0; // no green +
byte blueBrightness = 255; // full bright blue
myStrip.setPixelColor(NN, redBrightness, greenBrightness, blueBrightness);
// when you have set all the pixel colors, the call to show will update the physical strip:
myStrip.show();
}