When the door is closed an xray would be |= as the door is opened the | swiped across the = and a short. I opened the light [amazon 12 led motion] and did some modification so the 8266 would fit. Connected + to vcc and - to grd. One side of the = goes to grd and the other side to rst. The mailman drives up, opens the box to fill it full of junk mail and about 10 seconds later - bzzzzzzzzzzz. "You have smail....".
#include <ESP8266WiFi.h>
#include "Gsender.h"
#pragma region Globals
const char* ssid = "*****************";
const char* password = "*************";
IPAddress ip( 192, 168, 0, 1 ); // causes DHCP
IPAddress gateway( 192, 168, 0, 1 );
IPAddress subnet( 255, 255, 255, 0 );
#pragma endregion Globals
void WFcon ()
{
WiFi.softAPConfig (ip, gateway, subnet);
WiFi.begin (ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
}
void setup ()
{
delay (100);
WFcon ();
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
delay (100);
digitalWrite(LED_BUILTIN, LOW);
delay (1000);
digitalWrite(LED_BUILTIN, HIGH);
delay (100);
send_text ();
delay (5000);
ESP.deepSleep(-1);
}
void send_text()
{
String mytxt = "The Postman Always Rings Twice\n" + WiFi.localIP().toString();
Gsender *gsender = Gsender::Instance();
gsender->Send("7123456789@vtext.com", mytxt);
digitalWrite(LED_BUILTIN, HIGH);
}
void loop ()
{
}