Good night, I realized that when using the blynk sliding widget to turn on a led, it doesn’t seem to turn on as indicated.
I verified this by creating a button to send 50% brightness and then it lights up more than if I sent 50% on the slider.
tested with virtual and digital pin.
how to fix?
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "";
char ssid[] = "";
char pass[] = "";
const int ledPin = 4;
BLYNK_CONNECTED() {
Blynk.syncVirtual(V1);
Blynk.syncVirtual(V2);
}
BLYNK_WRITE(V1){
int value = param.asInt();
analogWrite(ledPin, value);
}
BLYNK_WRITE(V2)
{
int i=param.asInt();
if (i==1)
{
digitalWrite(ledPin, 127);
Blynk.virtualWrite(V1, 127);
}
else
{
digitalWrite(ledPin, LOW);
Blynk.virtualWrite(V1, 0);
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(ledPin, LOW);
pinMode(ledPin, OUTPUT);
}
void loop()
{
Blynk.run();
timer.run();
}