Last active
August 9, 2018 21:29
-
-
Save yakutozcan/d583b552796b5a73642e15e71948def1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://ifttt.com/maker_webhooks | |
//https://platform.ifttt.com | |
#include <ESP8266WiFi.h> | |
#include "IFTTTWebhook.h" | |
#define WIFI_SSID "======" | |
#define WIFI_PASSWORD "=======" | |
#define IFTTT_API_KEY "============" | |
#define IFTTT_EVENT_NAME "=========" | |
IFTTTWebhook wh(IFTTT_API_KEY, IFTTT_EVENT_NAME); | |
unsigned long previousMillis = 0; | |
const long interval = 5000; | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("RUNNING"); | |
WiFi.mode(WIFI_STA); | |
WiFi.disconnect(); | |
delay(100); | |
WiFi.begin(WIFI_SSID, WIFI_PASSWORD); | |
while (WiFi.status() != WL_CONNECTED) { | |
Serial.print("."); | |
delay(500); | |
} | |
Serial.println(""); | |
Serial.println("WiFi connected"); | |
Serial.println("IP address: "); | |
IPAddress ip = WiFi.localIP(); | |
Serial.println(ip); | |
wh.trigger("1"); | |
} | |
void loop() { | |
unsigned long currentMillis = millis(); | |
if (currentMillis - previousMillis >= interval) { | |
previousMillis = currentMillis; | |
wh.trigger("3"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment