10 LED's that are supposed to be red but aren't!

OK, thanks for the help so far guys.

jremington:
The 5V output on the Uno cannot provide much current and overloading it will cause the Arduino to malfunction.

Follow Adafruit's guide to powering them.

Forgive the ignorance but if I'm reading that correctly, rather than powering the LED's through the Uno, I can simply power them separately (via battery), just using the Uno to drive the data pin?

alto777:
Move strip.show out of the for loop. So after all the colors are set.

Add delay(100);

after that.

Danois90:
Another note; You do not need to call "show()" and "setBrightness()" for each pixel you set, and if you do not need to change the colors of the LED's, you can put your loop() code inside setup() since you only have to set the colors once. After that, you can put the Arduino to stand-by / low power mode to save some battery.

I think I've followed the advice regarding moving things out the loop. I'd have probably gotten to that point myself eventually once I started looking at improving the code but it's nice to have someone else QC'ing my code :smiley:

However, I'm a little uncertain as to the purpose of the delay. What is it supposed to achieve?

With respect to the low power mode, that would likely be a good idea in this particular example, but as I'm going to ultimately be working with an animation effect, I imagine that the Uno would have to remain on for that to work? If so, I'm not going to worry about adding it to this particular sketch.

Here is the sketch with the adjustments:

#include <Adafruit_NeoPixel.h>

#define PIN 6
#define PIX 10

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIX, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  // put your setup code here, to run once:
  strip.begin();
  strip.show();

  for(int i = 0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i,255,0,0);
    delay(100);  
    }
  strip.setBrightness(5);
  strip.show(); 
}

void loop() {
  // put your main code here, to run repeatedly:

   
}