So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By liderbug
#72052 Project done. Rural mailbox is plastic so I drilled 4 small hole lower front of box very close to the front edge. Another larger hole, 1/16", for the wire pair. The pair come in the bottom just under the 4 holes - which looks like :: bare wire from inside to outside and back in - looks like = Then on the door I did the same thing with one wire : -> |
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....".

Code: Select all#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 ()
{
}