Led Light Strip

I have a ws2812 led light strip that runs on 5v controlled by the arduino uno. What I would like to know is how to set up a code that turns a certain led on the strip on to a certain color. Thanks

Have you got any example code, perhaps from a library ?

http://www.tweaking4all.com/hardware/arduino/arduino-ws2812-led/ I am using the adafruit neopixel library and code from this website. It kind of shows you how to do it in the example above the source code but it doesnt work when I try to compile the sketch

but it doesnt work when I try to compile the sketch

What happens ? Do you get an error or does it compile but not do what you want ?

#include <Adafruit_NeoPixel.h>

#define PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, 6, NEO_GRB + NEO_KHZ800);

void setup() {


strip.show(); // Initialize all pixels to ‘off’

void loop() {
c = strip.Color(255, 0, 0); // define the variable c as RED (R,G,B)

strip.setPixelColor(10, c); // set LED 10 to the color in variable c (red)


That’s the code I used and the error message says ““c” was not declared in this scope”

Where did you declare 'c'? You try to assign a value to it, but you never declared it..

I'm not sure how to declare it. I am new to arduino

int c;

void setup() 

aarg: ``` int c;

void setup() //...{

I think you need uint32_t

uint32_t c;


Or avoid the need for "c" with

strip.setPixelColor(10, strip.Color(255, 0, 0));

Sure.. but that doesnt allow for any dynamic color changing. (where you can just always update the 'c' variable to a new color.....etc)

You should read the Adafruit guide: