Problem with arduino mini pro and Neopixel

So i've had this problem for some time, where every time i try to code the neopixel led strips, no matter what the code is about, the leds are always white and the only thing that i can change is the brightness. The led strip has an external alimentation, and i am coding arduino mini pro through arduino uno. (here is the tutorial i used for coding it ), i use the led strip GROVE- WS2813 RGB

Electric scheme:

code:

#include <Adafruit_NeoPixel.h> 
#define PIN 10 
#define NUM_LEDS 30 Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_RGB + NEO_KHZ800); 
void setup() { 
strip.begin();
 strip.show();
 strip.setPixelColor(0, strip.Color(255, 0, 0)); 
 strip.show(); 
}
 void loop() { }

Look at some of the examples from the Adafruit_NeoPixel library, you have left out the constructor, similar to this:

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

if you look at the 4th line of the code you see i put it in there, i dont really think the software is the problem since for some time i didn't have this problem, it randomly started doing this. I've also tried changing the arduino mini Pro, didn't work. I can contro the LED strip with only the arduino UNO, and i can succesfully upload any sketch to the mini pro this way; for example i am able to make a led blink or make it react to a switch. It only doesn't work with the LED strip

The code you posted has the constructor as part of the comment on the 3rd line.

yes sorry I've notice now that the code i linked is wrong, this is the actual code that I'm using:

#include <Adafruit_NeoPixel.h>

#define PIN 10

#define NUM_LEDS 30

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_RGB + NEO_KHZ800);

void setup() {

strip.begin();

strip.show();

strip.setPixelColor(0, strip.Color(255, 0, 0)); // Primo colore: Rosso

strip.show();

}

void loop() {

}
1 Like

A resistor is recommended on the signal line to the strip. ~500R, but the exact value is not critical.

Are you using a 5v or 3.3v mini pro?

Can you show the wiring when the UNO is disconnected? The still needs to be a common ground between the mini pro and the LED strip.

This code correctly lights one LED green, if the hardware is correct.

strip.Color(255, 0, 0)

Red.

a7

Is wokwi broken or does Adafruit change order in the library ? (library works)
In wokwi, the arguments (with this sketch):

  • NEO_GRB and NEO_BRG show red
  • NEO_RGB and NEO_RBG show green
  • NEO_GBR and NEO_BGR show blue

Added: although TBH your report doesn't seem to agree with what I wrote below, at least not with the number of brain cells I can get to focus on the issue just now.

No. wokwi uses a certain kind of LED as far as RGB order goes. Lie in the constructor and you get different colours.

The Color() method takes R, G and B components in that order. If your constructor matches your Neopixel's order, you get the right colour. All the ,ow level stuff that puts out data arranges it accordian to the claim you make BRG, whatever.

Compensating for the variations RGB, BGR, WRGB and so forth is handled entirely by claiming the correct order in the constructor. The rest of the code doesn't, and shouldn't, have to deal with rearranging things.

I always turn pixel 1 red, 2 green and 3 blue in setup just to confirm that I've specified the correct Neopixel type…

I go way back with RGB so usually I just roll my own colours as 32 bit unsigned long integers, so red for me is 0xff0000.

a7

In wokwi, FastLED with RGB in its constructor shows the expected R, G, B. (sorry for the side track, @nozzo )

OK, so this is inoperative?

Those both should make red given the abstract value for red.

I try myself when next in the lab.

a7

Gack!

Evidently wokwi has purchased an infinite supply of virtual Neopixels of the GRB type. I copied the constructor from somewhere some time ago - never mind how long precisely - and have been uncritically copy/pasting it from a snippets file. I'm really good at not seeing detail I don't need to see. My stuff worked fine, as I was operating one step up. I did not ever notice these:

// fastled
# define COLOR_ORDER    GRB

// lady ada
Adafruit_NeoPixel track(N_REAL, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);

@nozzo likewise sry for the distraction, but it is good to run this kind of thing to ground.

a7

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.