NodeMCU and Neopixel - Wrong Colors

Hi Guys :slight_smile:

got Probems with my Project.

Set up my NodeMCU with blynk and a simple sketch - here.

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Adafruit_NeoPixel.h>

char auth[] = "79454e8880a2402c86f78d1a88b02a04";

char ssid[] = "Viti112233";
char pass[] = "ERredswer";

#define PIN D5
#define NUMPIXELS 10
#define BLYNK_PRINT Serial

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

void setup()
  Blynk.begin(auth, ssid, pass);

  int R = param[0].asInt();
  int G = param[1].asInt();
  int B = param[2].asInt();
for(int i=0;i<10;i++) {
  strip.setPixelColor(i, strip.Color(R,G,B));;

void loop()

set up zeRGBa but if I choose a Color i got wrong color on my strip… some pixels are red, some black, some blue.

can anybody help?
your chris.

First… When posting your topic, you deleted (without reading) the instructions asking for all posted code to be formatted…

Blynk - FTFC

And speaking of reading instructions… You could always read the Neopixel instructions :wink:

I’m getting the wrong colors. Red and blue are swapped!
When using through-hole 8mm NeoPixels (or V1 Flora pixels), use NEO_RGB for the third parameter in the Adafruit_NeoPixel declaration. For all other types of NeoPixels, use NEO_GRB.

Or, if using the correct type of pixel type, swap your variables.

Best to place this after the for() count for smother run…

setPixelColor() does not have an immediate effect on the LEDs. To “push” the color data to the strip, call show(): This updates the whole strip at once, and despite the extra step is actually a good thing. If every call to setPixelColor() had an immediate effect, animation would appear jumpy rather than buttery smooth.

1 Like

Hi Gunne,

the Problem ist NOT that I got Red instead of Blue or Green.

The Problem ist:
If I Set in zeRGBa for example the Color Green my strip lights e.g.:
LED 1 = Blue
LED 2 = Blue
LED 3 = Red
LED 4 = Green

so I got random colors on each LED - but the (for) should set each pixel to the same color.

Solved the Problem by setting the baud rate in devicemanager of windows for COM6 to 19200 and also in the sketch and Serial Monitor.

Interesting theory, but nothing to do with the issue you described.
I had (and still have) a theory about what was actually causing your issue, but I was waiting for you to go back and edit your code as requested by @Gunner, but you never did.


1 Like