RFID Card Data send TO LINE Thru IFTTT
/************************************************************
ESP8266_NodeMCU_IFTTT_Maker.ino
IFTTT Channel Maker Posting Example
Andres Sabas @ The Inventor's House
Original Creation Date: Jan 10, 2016
This example demonstrates how to use the TCP client
functionality of the ESP8266 WiFiSecure library to post
to a IFTTT event on
https://ifttt.com
Development environment specifics:
IDE: Arduino 1.6.5
Hardware Platform:
ESP8266 HUZZAH Adafruit
or NodeMCU: 1.0
This code is beerware; if you see me (or any other The Inventor's House
member) at the local, and you've found our code helpful,
please buy us a round!
Distributed as-is; no warranty is given.
************************************************************/
//Include that library first:
#include <ESP8266WiFi.h>
// Include the ESP8266 WiFiSecure library:
#include <WiFiClientSecure.h>
//////////////////////////////
// WiFi Network Definitions //
//////////////////////////////
// Replace these two character strings with the name and
// password of your WiFi network.
const char mySSID[] = "PTS-2F";
const char myPSK[] = "";
/////////////////////
// IFTTT Constants //
/////////////////////
// IFTTT destination server:
const char* IFTTTServer = "maker.ifttt.com";
// IFTTT https por:
const int httpsPort = 443;
// IFTTT Event:
const String MakerIFTTT_Event = "button";
// IFTTT private key:
const String MakerIFTTT_Key = "zaHdzsOGgZ71vZT1Y1FA6";
String httpHeader = "POST /trigger/"+MakerIFTTT_Event+"/with/key/"+MakerIFTTT_Key +" HTTP/1.1\r\n" +
"Host: " + IFTTTServer + "\r\n" +
"Content-Type: application/x-www-form-urlencoded\r\n\r\n";
void setup()
{
int status;
Serial.begin(115200);
Serial.println();
Serial.print(F("connecting to "));
Serial.println(mySSID);
WiFi.begin(mySSID, myPSK);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println(F("WiFi connected"));
Serial.println(F("IP address is: "));
Serial.println(WiFi.localIP());
Serial.println(F("Press any key to post to IFTTT!"));
}
void loop()
{
// If a character has been received over serial:
if (Serial.available())
{
// !!! Make sure we haven't posted recently
// Post to IFTTT!
postToIFTTT();
// Then clear the serial buffer:
while (Serial.available())
Serial.read();
}
}
void postToIFTTT()
{
// Create a client, and initiate a connection
WiFiClientSecure client;
if (client.connect(IFTTTServer, httpsPort) <= 0)
{
Serial.println(F("Failed to connect to server."));
return;
}
Serial.println(F("Connected."));
Serial.println(F("Posting to IFTT Event!"));
client.print(httpHeader);
// available() will return the number of characters
// currently in the receive buffer.
while (client.available())
Serial.write(client.read()); // read() gets the FIFO char
// connected() is a boolean return value - 1 if the
// connection is active, 0 if it's closed.
if (client.connected())
client.stop(); // stop() closes a TCP connection.
}
訂閱:
張貼留言 (Atom)
Messaging API作為替代方案
LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...
-
python pip 不是内部或外部命令 -- 解決方法 要安裝 Pyqt5 1. 首先,開啟命令提示字元。 2. 輸入 pip3 install pyqt5 好像不能執行 ! ! 錯誤顯示 : ‘ pip3 ’ 不是內部或外部命令、可執行的程式或批...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...
-
• 認 識 PreFix、InFix、PostFix PreFix(前序式):* + 1 2 + 3 4 InFix(中序式): (1+2)*(3+4) PostFix(後序式):1 2 + 3 4 + * 後 序式的運算 例如: 運算時由 後序式的...
沒有留言:
張貼留言