BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Problems using servo with Blynk

Im trying to run a servo using push button with esp8266 node mcu. The runs well but when I insert blynk statements it dosent run. Is my code is wrong plz help

#include <Servo.h>
#include <SimpleTimer.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

SimpleTimer timer;
Servo servo1;

char auth[] = "6ri9E_diXys4DvhS1ulntv8Tpa2kXdrk";

char ssid[] = "adik";
char pass[] = "1234567890";

WidgetLCD lcd1(V1);
void setup()
{
    Serial.begin(9600);

    pinMode(D5, INPUT);
        
    servo1.attach(D8);
    servo1.write(0);
    Blynk.begin(auth, ssid, pass);
    lcd1.clear();
    
    timer.setInterval(1000L, servoDataSend); //timer will run every sec 
}

void servoDataSend()
{
     int key1 = digitalRead(D5);
     if (key1 == HIGH)
      {
      servo1.write(90);
      delay(2000);
      servo1.write(0);
      }
        else
      {
        servo1.write(0);
      }  
}
void loop()
{
 Blynk.run();
 timer.run();       
}

@adityakoyande96 when you write an email, do you put the whole contents of the email in the subject line?
I’ve fixed this for you!

Which Blynk statements, and where have you inserted them?

Do you mean it doesn’t compile, doesn’t connect to the Blynk server, doesn’t function in the way that you want, or something else? Don’t be afraid to be specific!

Pete.

Thankyou Sir, for fixing the sub, I will remember it from the next time. I was trying to figure out the problem it was in the hardware connections. Thanks for ur valuable time.