Hi,
I must be doing something fundamentally wrong here but can’t seem to figure it out!!
All I’m trying is to use an example code for the zeRGBa widget, read the values, print them on the serial monitor window and set the appropriate color using the neo pixel library.
Hardware: WeMos D1 mini
Code:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Adafruit_NeoPixel.h>
#include SPI.h
#define PIN 1 // GPIO pin
#define NUMPIXELS 3 // Number of pixels in strip
#define BLYNK_PRINT Serial
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
char auth[] = "**************";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "########";
char pass[] = "**********";
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pixels.begin();
pixels.show();
}
BLYNK_WRITE(V1) // Widget WRITEs to Virtual Pin V1
{
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.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(R,G,B)); // Moderately bright green color.
pixels.show(); // This sends the updated pixel color to the hardware.
}
}
void loop()
{
Blynk.run();
}