Hey there, this is my first time making one of these so please be gentle.
So I have been trying to get my Arduino Uno to control my RGBW digital led strip that I have bought, how ever the only code I have found to control led strips is for only the ESP8266 chips and not the arduino uno.
I have tried to frankenstein the code( I’ve tried my best to get to learn the code as well and still am learning) what I did is I took the code for the ESP8266 and tried to mix it into the serial USB example sketch from the arduino IDE, low and behold I ran into errors.
Here is the ESP8266 code:
#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WiFi.h>
#define PIN D2
#define NUMPIXELS 30
#define BLYNK_PRINT Serial
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
Serial.begin(9600);
Blynk.begin("Authentication Token", "SSID", "Password");
pixels.begin();
}
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();
}
}
void loop()
{
Blynk.run();
}
Here is the example Blynk serial to usb :
#define BLYNK_PRINT DebugSerial
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#include <BlynkSimpleStream.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
DebugSerial.begin(9600);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
}
So what I’ve ended up with is a really messy piece of code and I would really appreciate it if someone could direct me in what I’ve done wrong as with all the research I’ve done I came up empty on any examples on arduino uno’s code for controlling led strips.
Here is the mess I’ve made:
#include <Adafruit_NeoPixel.h>
#define PIN D7
#define NUMPIXELS 150
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#include <BlynkSimpleStream.h>
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
Serial.begin(9600);
Blynk.begin("Authentication Token");
pixels.begin();
}
BLYNK_WRITE(V7)
{
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();
}
}
void loop()
{
Blynk.run();
} ```
What I'm trying to make is that I can use a zeRGBa to control the color and then add a slider for the dimming of the strip.
So sorry if I have laid this our wrong or used the wrong lingo or tags.
Any help is appreciated <3
Kind regards