Simple IoT Board用のIFTTTのMaker Channelに繋げるためのサンプルです。
Dependencies: SimpleIoTBoardLib mbed
main.cpp@0:8459cf3d30f7, 2015-11-15 (annotated)
- Committer:
- jksoft
- Date:
- Sun Nov 15 13:44:04 2015 +0000
- Revision:
- 0:8459cf3d30f7
??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8459cf3d30f7 | 1 | #include "mbed.h" |
jksoft | 0:8459cf3d30f7 | 2 | #include "ESP8266Interface.h" |
jksoft | 0:8459cf3d30f7 | 3 | #include "TCPSocketConnection.h" |
jksoft | 0:8459cf3d30f7 | 4 | #include "ifttt.h" |
jksoft | 0:8459cf3d30f7 | 5 | #include "SoftSerialSendOnry.h" |
jksoft | 0:8459cf3d30f7 | 6 | |
jksoft | 0:8459cf3d30f7 | 7 | AnalogIn thermistor(dp13); /* Temperature sensor connected to Analog Grove connector */ |
jksoft | 0:8459cf3d30f7 | 8 | |
jksoft | 0:8459cf3d30f7 | 9 | ESP8266Interface wifi(dp16,dp15,dp4,"SSID","Password",115200); // TX,RX,Reset,SSID,Password,Baud |
jksoft | 0:8459cf3d30f7 | 10 | |
jksoft | 0:8459cf3d30f7 | 11 | SoftSerialSendOnry pc(dp10); // tx |
jksoft | 0:8459cf3d30f7 | 12 | |
jksoft | 0:8459cf3d30f7 | 13 | int main() |
jksoft | 0:8459cf3d30f7 | 14 | { |
jksoft | 0:8459cf3d30f7 | 15 | pc.baud(9600); |
jksoft | 0:8459cf3d30f7 | 16 | wifi.init(); //Reset |
jksoft | 0:8459cf3d30f7 | 17 | wifi.connect(); //Use DHCP |
jksoft | 0:8459cf3d30f7 | 18 | pc.printf("IP Address is %s \n\r", wifi.getIPAddress()); |
jksoft | 0:8459cf3d30f7 | 19 | TCPSocketConnection socket; |
jksoft | 0:8459cf3d30f7 | 20 | |
jksoft | 0:8459cf3d30f7 | 21 | // Initialize ifttt object, add up to 3 optional values, trigger event. |
jksoft | 0:8459cf3d30f7 | 22 | IFTTT ifttt("EventName","Secret Key", &socket); // EventName, Secret Key, socket to use |
jksoft | 0:8459cf3d30f7 | 23 | |
jksoft | 0:8459cf3d30f7 | 24 | ifttt.addIngredients("value1","value2","value3"); |
jksoft | 0:8459cf3d30f7 | 25 | ifttt.trigger(IFTTT_POST); |
jksoft | 0:8459cf3d30f7 | 26 | } |