// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLqKhQ3hsc"
#define BLYNK_DEVICE_NAME "NodeMCU"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG
// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
//#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI
#include "BlynkEdgent.h"
BLYNK_WRITE(V0)
{
if(param.asInt()==1){
digitalWrite(5, HIGH);
}
else{
digitalWrite(5,LOW);
}
}
BLYNK_CONNECTED()
{
Blynk.syncVirtual(V0);
}
void setup()
{
pinMode(5, OUTPUT);
Serial.begin(9600);
delay(100);
BlynkEdgent.begin();
}
void loop() {
BlynkEdgent.run();
}
Here is a photo of the circuit.
Sometimes it will turn on and off without orders from the BLYNK app, sometimes it will work but it rarely does consistently.
SOLVED: there was problem with the motor apparently and the d2 pin