Hi,
Im trying to use the Blynk App with Wemos ESP8266 to control some LED Stripes. I get some “light” but the wrong colours.
The Arduino Code:
#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WiFi.h>
#define PIN D2
#define NUMPIXELS 144
#define BLYNK_PRINT Serial
BlynkTimer timer;
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
Serial.begin(9600);
Blynk.begin("xxxxx", "yyyyy", "zzzzz");
pixels.begin();
pixels.setBrightness(55);
}
void loop()
{
Blynk.run();
timer.run();
}
BLYNK_WRITE(V2)
{
int R = param[0].asInt();
int G = param[1].asInt();
int B = param[2].asInt();
Serial.println(R);
Serial.println(G);
Serial.println(B);
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(R, G, B));
pixels.show();
}
}
In Blynk Im using zuRGBa Merge to V2 and 0 to 1023 for each colour.
When I connect and set a new colour, I get wrong colours. Or I understand it wrong?
In example I change the colours in Blynk and on the left corner I have
V2 821 0 0
In Arduino Serial monitor, I have the same colours. But the Leds are rainbow. first LED light middle red, second light green/yellow, third light blue with purple. Repeating this colours.
As I understand it, all LEDs should be in red. What am I doing wrong?