○ライブラリのインストール
IFTTTのMaker用のライブラリをインストールするには、次のように操作します。
①ESP8266 IFTTT Maker library(IFTTT-esp-master.zip)をダウンロードします。
②Arduino IDEを起動します。
③[スケッチ]→[ライブラリをインクルード]→[.ZIP形式のライブラリをインクルード]を選択します。
④ダウンロードしたZIPファイル「IFTTT-esp-master.zip)」を選択し、[開く]をクリックします。
○プログラム(スケッチ)
※プログラムを書込む際には、GPIO0をLowにします。
IFTTTのMakeにデータを送信するプログラムは、次のように書きます。
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
#include "IFTTTESP8266.h" | |
#define EVENT "Your_Maker_Event_Name_here" // Put here your Maker Event Name | |
#define KEY "Your_Key_here" // Put here your IFTTT key | |
#define WIFISSID "ssid" | |
#define PASSWORD "password" | |
IFTTT client(KEY); | |
void setup(){ | |
Serial.begin(115200); | |
delay(10); | |
client.wifiConnection(WIFISSID, PASSWORD); | |
} | |
void loop(){ | |
String value = String(analogRead(A0)); | |
client.add(value1); // specifies the args of type "String" | |
//Send value can specify up to three | |
client.add(value2); // optional | |
client.add(value3); // optional | |
client.sendAll(EVENT); | |
} |
データは最大3つ送信できます。データはString型で指定する必要があります。
IFTTTのMakerについては、以下の記事を参照してください。
0 件のコメント:
コメントを投稿