Would a delay in the code work to reset my servo controlled light switch back to a neutral position? Right now I have a Switch/Button in the Blynk app set to various values to switch the light switch at home to on or off. I want to have it reset to a neutral position after the button is switched to on or off.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
Servo servo;
BLYNK_WRITE(V3) {
servo.write(param.asInt());
#these two lines are my edits delay(500);
#servo.write(60);
}
void setup() {
// Debug console Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
servo.attach(15); // 15 means D8 pin of ESP8266
}
void loop()
{
Blynk.run(); // You can inject your own code or combine it with other sketches.
}