Skip to content

Commit

Permalink
Added static IP Address
Browse files Browse the repository at this point in the history
Added static IP Address and a few more useful comments.
  • Loading branch information
641i130 authored Dec 3, 2020
1 parent bdbdd28 commit be6a155
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ int del = 2000;
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
int x = 0;
char *arr[] = {"00 00 00 00"};
int arrlen = 1; // Length of arr
int arrlen = 1;
int t;
String cardid;

// Variables for webserver
String password = "Web Server Pasword! Change ME!";
String password = "CHANGEME";
ESP8266WebServer server(80);

// Variables and Functions for IFTTT
String sifttt = "maker.ifttt.com";
String resource = "IFTTT Auth Key";
String resource = "Token";

void handleRoot() {
String s = page; //Read HTML contents
server.send(200, "text/html", s);
}
void sendcid(String cardid) {
if (cardid != "" && x == 0) {
String jsonObject = String("{\"value1\":\"") + cardid + "\"}";
String jsonObject = String("{\"value1\":\"") + cardid + "\"" + "," + String("\"value2\":\"") + "Location" + "\"}";
//sifttt
Serial.print("Sending: "+jsonObject);

Expand Down Expand Up @@ -106,8 +106,12 @@ void setup() {

// Wifi connect / Server start
const char* ssid = "SSID";
const char* password = "SSID PASS";
const char* password = "SSID-PASSWORD";
WiFi.begin(ssid, password);
IPAddress staticIP(192, 168, 1, 196); // Static IP Address
IPAddress gateway(192, 168, 1, 10); // Gateway (usually its your main router in the building)
IPAddress subnet(255, 255, 255, 0); // Do some searching on how to get this
IPAddress dns(1, 1, 1, 1); // Not really needed unless you're requesting info from external sites
// Connect to self to host server
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Expand Down Expand Up @@ -163,5 +167,5 @@ void loop() {
Serial.println(" Access denied");
sendcid(cardid);
delay(del);
del = del*2; /// exponential wait time to mitigate brute forcing
del = del*2; // Exponential wait time to mitigate brute force attacks
}

0 comments on commit be6a155

Please sign in to comment.