Digital pins not powering motor (SOLVED)
Posted: Fri Jan 07, 2022 12:40 pm
Hi! I'm currently trying to learn to use the esp 8266 connected to BLYNK for a competition, but I'm unable to use the digital pins to power anything. I'm using a ESP8266 12-E NodeMCU Kit. I tried connecting the pins to a voltmeter and it shows that there is enough volts. I am also able to turn the on board LED on and off using BLYNK. Here is my code.
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
Code: Select all
// 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