Led is not turning off

Hello there,

today I received a APA102 Dotstar led strip consisting of 144 LEDs/m. I wanted to start and connected the Datapin to Pin 11 on my Arduino Uno and the Clockpin on 13 to use the spi-bus.

After that I downloaded the Adafruit Dotstar library and loaded the strandtest. The strip is working but there is always one led turned on which shouldnt be.

I defined the maximum of pixels to 30 since I just experiment with it. And the exact last led is always turned on in blue color.

I don’t want it to be blue. Normally it should be turned off. Do you may know what’s wrong with that?
Here the code:

#include <SPI.h>
#include <Adafruit_DotStar.h>

#define NUMPIXELS 30

//Create the strip
Adafruit_DotStar strip = Adafruit_DotStar(
  NUMPIXELS, DOTSTAR_BRG);

void setup() {
  strip.begin(); //Initialize the strip
  strip.show();  //turn off all LEDs within numpixels

}

void loop() {
  strip.setPixelColor(6, 0xFF0000); //First value = LED / Second Value = Color
                                     //Color format: GRB
  strip.show();

}

Your LED numbers go from zero. So if you define you have 30 then the loop which runs to change the colour must go from 0 to 29.

That code will only set the led number 6 to green, providing you do have a GRB strip. That number will be the seventh in the strip.

I know that but, that wasn’t my question sorry if I’ve been unclear.

Let me try to rephrase it:
I have a strip consisting of 144 LEDs. For testing purpose I declared 30 to be active. When I don’t run the code with any color set the last led of those 30 (29) is set on blue.

Simply put: I don’t have any color set, but the strip still shows me a color at the end of the declared leds.
→ So led 29 is blue without setting any color to the strip.

(LEDs 0-28 are off (as expected) and LED 29 is “blue” although all leds should be off)

Still confused.
Have you set the LEDs up to this to be off?
What code is it?
Does the code you posted have anything to do with your question?

When I don't run the code with any color set

What does that mean? You always have to set a colour even if it is black ( off )

Try changing the number of LEDs you set to black, is it always the last one.

I can think of two things that might be wrong.

  1. You have a miss match between the declared array and the LEDs you are turning off.

  2. If no code is involved then, do you know that LEDs can power up in any state and a favorite colour for them to power up is cyan, which you might describe as light blue.

strip.begin(); //Initialize the strip

That line does nothing to the strip but initialises the libiary.

These two lines / comments do not tell the same story either

Adafruit_DotStar strip = Adafruit_DotStar(
  NUMPIXELS, DOTSTAR_BRG);

and

strip.setPixelColor(6, 0xFF0000); //First value = LED / Second Value = Color
                                     //Color format: GRB

Thank you for your reply.

So those two code snippets dont seem wrong to me:

Adafruit_DotStar strip = Adafruit_DotStar(
  NUMPIXELS, DOTSTAR_BRG);
  strip.setPixelColor(6, 0xFF0000); //First value = LED / Second Value = Color
                                     //Color format: GRB

With "NUMPIXELS" I set the maximum of leds to my "#define NUMPIXELS 30'. Which means that I can use a maximum of 30 leds on that strip.
The second one "DOTSTAR_BRG" is to initialize the color code the strip uses. But since the color code isn't using "Blue, Red, Green" it uses "Green, Red, Blue".

The second code snippet is just like the initialized strip. First I tell with "6" the number of led I want to light up and then the color "0xFF000000" which is green.

So I don't see anything wrong since it works fine.

If no code is involved then, do you know that LEDs can power up in any state and a favorite colour for them to power up is cyan, which you might describe as light blue.

I didn't know. But that may explains it. When I set a maximum of 30 leds to use and the others aren't used in the code, they light up with that cyan color. When I use all of my 144 leds no color is displayed since I use the full strip.

Since those 30 leds are just for testing purpose only it isn't that much of a problem that other leds are turned on. I will uses the full strip later on.

So I don't see anything wrong since it works fine.

The point is that you have two contradictory comments / instructions. In general this normally points to confusion on the part of the writer.

In the first snippet you are telling the libiary that you have a strip that is BRG, then in the second you have a comment that the strip numbers are being treated as GRB.

That is what I was trying to point out.

this normally points to confusion on the part of the writer

Yes. The time I saw this I was confused myself. But when it was explained in a video I understood.
But what you're saying is right. It confuses.

So why did you not correct the comment?

So why did you not correct the comment?

Which one now exactly?

I got another question which isn't that topic relevant: If I have another problem with another little project, should I make another thread about it?

SchnoppDog:
Which one now exactly?

I got another question which isn’t that topic relevant: If I have another problem with another little project, should I make another thread about it?

Yes

Which one now exactly?

Exactly the one that is wrong.