Hola, no sé como puedo hacer para que mi servomotor gire 2 segundos en sentido anti horario (botón V1) y luego pare, y que después apretando V2 gire en sentido horario 2 segundos y pare. Sólo puedo hacer que vaya de una dirección a otra, pero no hacer que se detenga. O bien que gire en direccion anti horaria apretando V1 y luego apretar V2 para que se detenga y que gire en sentido horario cuando presione V3.
#define BLYNK_TEMPLATE_ID "TMPLjrLCHD7R"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "z6oDvz0HyzjEBXuKyLkoG67J5VogShkZ"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
Servo servo;
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Javi";
char pass[] = "Contraseñaxd";
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
servo.attach(2); // NodeMCU D8 pin
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
BLYNK_WRITE(V1)
{
servo.writeMicroseconds(500);
}
BLYNK_WRITE(V2)
{
servo.writeMicroseconds(1500);
}
BLYNK_WRITE(V3)
{
servo.writeMicroseconds(1550);
}