Hi all
I need help with adding additional functionality to my code,
I am using blynk with an esp8266 nodemcu to control a servo.
I would like to add a relay in to the mix, so i need to energise the field coil of the relay before the servo portion of the sketch runs, then de-energise the field coil after.
Basically, im powering my servo externally, and instead of having power to it all the time, i want to use a relay to cut the power in before servo runs, then cut the power until i press my button in blynk again.
Ive tried a bunch of different ways but none of them seem to work,
The code im using can be seen below.
Any help would be greatly appreciated
Kind regards.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
Servo servo;
char auth[] = "your auth token";
char ssid[] = "your wifi name";
char pass[] = "your wifi password";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
servo.attach(15); // NodeMCU D8 pin
}
void loop()
{
Blynk.run();
}
BLYNK_WRITE(V1)
{
servo.write(0);
delay(2500);
servo.write(90);
delay(0);
}