Hello Everyone,
I have a problem with controlling the brightness of my LED strip with a Blynker Slyder.
When I turn the brightness of the LEDs darker, the light flickers.
At first, I thought that it could be a problem with the hardware, but after trying some things I came to the conclusion that it has to be a problem with the software.
This is the code where the LED are flicking:
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
const int ledPinCW = 14;
const int ledPinWW = 12;
const int freq = 4000;
const int ledChannel = 0;
const int resolution = 8;
char auth[] = "";
char ssid[] = "";
char pass[] = "";
BLYNK_WRITE(V1)
{
int dutyCycle = param.asInt();
ledcWrite(ledChannel, dutyCycle);
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(ledPinCW, ledChannel);
ledcAttachPin(ledPinWW, ledChannel);
}
void loop()
{
Blynk.run();
}
Why I am thinking its a software problem is, is because I have no problems with the same code only without the blynk.run():
const int ledPinCW = 14;
const int ledPinWW = 12;
const int freq = 4000;
const int ledChannel = 0;
const int resolution = 8;
void setup(){
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(ledPinCW, ledChannel);
ledcAttachPin(ledPinWW, ledChannel);
}
void loop(){
int dutyCycle = 238;
ledcWrite(ledChannel, dutyCycle);
}
I hope someone can help me, because I have no idea how to solve this.
Here a short overview with the parts I am working with:
ESP-32 https://www.az-delivery.de/products/esp32-developmentboard?ls=en&cache=false
LED Amplifier https://www.optonicaled.com/products/view/led-rgbw-strip-amplifier-none-none
I am using GPIO 12 and 14 for the warm/cold white and the GND for V+ on the Amplifier.