Hi, everyone.
New here and begginer at Blynk. I wish I could have some help.
I’m trying to control two hacked servos with a Wemos D1 board and Blynk. The code seems not to be the problem but the power supply.
Since the idea is to control it via Wifi, I’m using a 9V battery but the device gets disconnected every time I press something in the app. But when I power it via USB to my computer, the app works with no problem. So I guess it’s the battery.
Is there any solution to this? I’m not familiar with the power supply at all.
Here’s the code too:
#define BLYNK_PRINT Serial
#include <Servo.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
Servo myservo2;
Servo myservo1;
BlynkTimer timer;
char auth[] = "xxx";
char ssid[] = "xxx";
char pass[] = "xxx";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
myservo1.attach(14);
myservo2.attach(15);
}
BLYNK_WRITE(V1){
if(param.asInt() < 30){
servo1atras();
}
if(param.asInt() > 150){
servo1adelante();
}
}
BLYNK_WRITE(V2){
if(param.asInt() < 30){
servo2atras();
}
if(param.asInt() > 150){
servo2adelante();
}
}
void servo1adelante(){
myservo1.write(150);
delay(15);
}
void servo1atras(){
myservo1.write(30);
delay(15);
}
void servo2adelante(){
myservo2.write(150);
delay(15);
}
void servo2atras(){
myservo1.write(30);
delay(15);
}
void loop(){
Blynk.run();
timer.run();
}
Sorry if the answer was in other topic but I tried to search for it and I couldn’t find the answer ):