I have connected Wemos D1 Mini with servo motor, also designed blynk app for control the movement of the servo motor and wrote code of it all things pass4ed fine until I tried to use the blynk app to control the movement of the servo , it couldn’t connect to network (Wemos Wi1fi) inside app and wrote (wasn’t online yet) so I couldn’t try blynk 4.
please there is anyone have an idea how can I solve this problem or where the problem exactly?
This is Photo for the problem in my app:
Hardware model:
Wemos . . . . servo
Gnd . . . . Brown
5V . . . . Red
D4 . . . . Yellow
This is My code:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
char auth[] = "A0BpknRKFxxagGXlkxzvuFSDX-rrOnAu";
char ssid[] = "sssssss"; //nama wifi
char pass[] = "12345"; //password wifi
Servo servo;
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
servo.attach(2);
}
void servo_via_button1() {
int pos;
//from 0 - to 180
for (pos = 0; pos <= 180; pos += 1) {
servo.write(pos);
delay(15);
}
}
void servo_via_button2() {
int pos1;4444
//from 180 - to 0
for (pos1 = 180; pos1 >= 0; pos1 -= 1) {
servo.write(pos1);
delay(15);
}
}
BLYNK_WRITE(V3) {
//servo.write(param.asInt());
int pinValue = param.asInt();
if (pinValue == 1) {
servo_via_button1();
Blynk.run();
int pinValue = 0;
Blynk.syncVirtual(V3);
}
}
BLYNK_WRITE(V4) {
int pinValue1 = param.asInt();
if (pinValue1 == 1) {
servo_via_button2();
Blynk.run();
int pinValue1 = 0;
Blynk.syncVirtual(V4);
}
}
BLYNK_WRITE(V5)
{
servo.write(param.asInt());
}
void loop()
{
Blynk.run();
}