So i just wrote some code while waiting for my camera to be delivered and i was thinking i could share that already.
So i’m gonna hang a camera in my room so i can play around with blynk while im not home and see how the hardware responds, but i did not want my brother to access the camera (we share a Blynk account). So i used the terminal to make it password protected. Basically you enter the password in the terminal widget and a relay will power up the camera. If the password is correct you will get a notification if its not you also will get a notification and an email that tells you someone tried to access it. When my camera and camera mount arrive i will share the extra code that will be used to control the servos to make the camera move. But until then i only have this to share. Im open to any questions. Enjoy !
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "xxxxx";
char ssid[] = "xxxxx";
char pass[] = "xxxxx";
WidgetTerminal terminal (V1);
BLYNK_WRITE(V1)
{
if (String("YOUR PASSWORD HERE") == param.asStr()) {
terminal.println("Password accepted") ;
Blynk.notify("Warning, someone succesfully accessed camera controls");
digitalWrite (4, LOW);
} else {
terminal.print("Password denied");
Blynk.notify("Warning, someone tried to access camera controls");
Blynk.email("YOUR EMAIL HERE", "Failed camera login", "Warning, someone tried to access camera controls");
terminal.write(param.getBuffer(), param.getLength());
terminal.println();
digitalWrite (4,HIGH);
}
terminal.flush();
}
void setup()
{
pinMode (4, OUTPUT);
digitalWrite (4, HIGH);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
terminal.println(F("Blynk v" BLYNK_VERSION ": Hardware connected"));
terminal.println(F("--------"));
terminal.println(F("Type the password to access camera controls"));
terminal.println(F("Anything else will result in authentication failure"));
terminal.flush();
}
void loop()
{
Blynk.run();
}
Some pictures