I use an Wemos D1 Mini and i want to turn on/off 12v led that flickers with the Blynk app for iOS. (See my code under)
My wiring is correct because the led flicker if i just sett it in code, but i do not know how to make it flicker when i turned it on/off from the app. I can make the led turn on/off, but it does not flicker.
I’m not specially good with coding, and need som help to make this work.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int powerled = 14;
char auth[] = "***";
char ssid[] = "***";
char pass[] = "***";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(powerled, OUTPUT);
}
void candlelight(){
if(powerled == HIGH){
analogWrite(powerled, random(120) + 135);
delay(random(300));
}
if(powerled == LOW){
analogWrite(powerled, LOW);
}
}
void loop()
{
Blynk.run();
candlelight();
}