# Simple Arduino Neopixel Test

1,876

8

## Introduction: Simple Arduino Neopixel Test

Hello instructable

you know the struggle when you write a code for your neopixel leds and you are not sure if your neopixel led is working well or your code is messed up ?

anyway i know this problem,

so i made a little test code to see your leds light up red,green,blue

if you want to make this work you will need:

1. an arduino
4. 5v adapter DC (since we dont want to molest the 5v from your arduino and the neopixel leds tend to ask alot mA

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Starting Up

first you want to make sure you got the code

#include

int c = 0; //secret

int r; //red

int g; //green

int b; //blue

# define count 11 // number of leds

# define Pixel 2 // com. pin from your neo pixel

# define p 25 //brightness 0 - 255

# define flow 35 // flow rate from first to last led 1000 = 1 sec

void setup()

{

pix.begin();

for (int a = 0 ;a<=count ; a = a+1)

{

if (a > count-1 && c < 3) {c = c+1; a = -1;}

else if (c == 0) {r = p; g = 0; b = 0; }

else if (c == 1) {r = 0; g = p; b = 0; }

else if (c == 2) {r = 0; g = 0; b = p; }

else if (c == 3) {r = 0; g = 0; b = 0; }

pix.setPixelColor(a,r,g,b);

pix.show();

delay(flow);

}

}

void loop()

{

for (int x =0; x <= count-1 ; x++)

{

pix.setPixelColor(x,p,0,0);

pix.show();

delay(500);

pix.setPixelColor(x,0,0,0);

pix.show();

delay(500);

for (;x==10;x=-1);

{

delay(500);

}

}

}

## Step 2: Adjusting the Code

there are some things i can not know , when i was making this

so i made constantes you need to fill in ,those are:

1. number of leds (#define count)
2. pin on witch your com. is connected (#define Pixel)
3. the brightnes (#define p )

in my case the ''settings'' are

1. = 11 (#define count 11)
2. = 2 (#define Pixel 2)
3. = 25 (#define p 25)

## Step 3: Wire Up

1. disconnect the usb
2. connect the 5v- to gnd of your neopixel led and arduino
3. connect the 5v+ to the + of your neopixel led and vin of your arduino
4. com. from your neopixel led to the choosen pin on the arduino

the test is just a once flash and as soon its done your neopixel led wil flash red (each led apart)

i hope i helped you guys with this

this was my first instructable

and yes i know my english is very derpy and bad . sorrey and BYE!