Esp8266 nodemcu + ide arduino, controlar un servomotor

The project consists of controlling a servomotor using ** Only a Blynk BUTTON ** that connected to the ESP8266 NODEMCU activates the Servomotor from 0 to 180 degrees and after 5 seconds returning from 180 to 0 degrees.

It is the first time you use the ESP8266, and it cannot be used to apply automatic closing after 5 seconds of pressing the button.

What should I do so that my current programming works with a single button and the servo automatically returns after 5 seconds.

This is my current program.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>


char auth[] = "qxVlIzxoGj9E7yVkfIWpQdMYuT7FX-ZS";
char ssid[] = "ARRIS-1E42";
char pass[] = "99CA7C7B3720ACAC";

Servo servo;
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  servo.attach(D4); 
}
BLYNK_WRITE(V1){
  servo.write(0);
}
BLYNK_WRITE(V2){
  servo.write(180);
}
void loop()
{
  Blynk.run();
}

@Fabrizio056 please edit your post (using the pencil icon at the bottom of the post) and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like

I think now I corrected the post.

Search the forum for examples of how to use timeout timers.

Pete.