This is an example for sending data to IFTTT using WizFi250

Dependencies:   IFTTT WizFi250Interface mbed

Committer:
jehoon
Date:
Thu Jul 23 05:54:58 2015 +0000
Revision:
0:e8b5220fd0c8
This is an example for Connect IFTTT using WizFi250 and WIZwiki-W7500.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jehoon 0:e8b5220fd0c8 1 #include "mbed.h"
jehoon 0:e8b5220fd0c8 2 #include "WizFi250Interface.h"
jehoon 0:e8b5220fd0c8 3 #include "ifttt.h"
jehoon 0:e8b5220fd0c8 4
jehoon 0:e8b5220fd0c8 5 #define SECURE WizFi250::SEC_AUTO
jehoon 0:e8b5220fd0c8 6 #define SSID "ssid"
jehoon 0:e8b5220fd0c8 7 #define PASS "password"
jehoon 0:e8b5220fd0c8 8
jehoon 0:e8b5220fd0c8 9 #define YourEventName "YourEventName"
jehoon 0:e8b5220fd0c8 10 #define YourSecretKey "YourSecretKey"
jehoon 0:e8b5220fd0c8 11
jehoon 0:e8b5220fd0c8 12 WizFi250Interface wizfi250(D1,D0,D7,D8,PA_12,NC,115200);
jehoon 0:e8b5220fd0c8 13 TCPSocketConnection sock;
jehoon 0:e8b5220fd0c8 14 Serial pc(USBTX, USBRX); // tx, rx
jehoon 0:e8b5220fd0c8 15
jehoon 0:e8b5220fd0c8 16 int main()
jehoon 0:e8b5220fd0c8 17 {
jehoon 0:e8b5220fd0c8 18 pc.baud(115200);
jehoon 0:e8b5220fd0c8 19
jehoon 0:e8b5220fd0c8 20 pc.printf("WizFi250_IFTTT Send example. \r\n");
jehoon 0:e8b5220fd0c8 21 wizfi250.init();
jehoon 0:e8b5220fd0c8 22 wizfi250.connect(SECURE, SSID, PASS);
jehoon 0:e8b5220fd0c8 23 pc.printf("IP Address is %s\r\n", wizfi250.getIPAddress());
jehoon 0:e8b5220fd0c8 24
jehoon 0:e8b5220fd0c8 25 // Initialize ifttt object, add up to 3 optional values, trigger event.
jehoon 0:e8b5220fd0c8 26 IFTTT ifttt(YourEventName,YourSecretKey, &sock); // EventName, Secret Key, socket to use
jehoon 0:e8b5220fd0c8 27 ifttt.addIngredients("this is awesome","test-ing","data!!!"); // 3 optional Values to send along with trigger.
jehoon 0:e8b5220fd0c8 28 ifttt.trigger();
jehoon 0:e8b5220fd0c8 29
jehoon 0:e8b5220fd0c8 30 // Send data using GET
jehoon 0:e8b5220fd0c8 31 ifttt.addIngredients("Sending","GET","data");
jehoon 0:e8b5220fd0c8 32 ifttt.trigger(IFTTT_GET);
jehoon 0:e8b5220fd0c8 33
jehoon 0:e8b5220fd0c8 34 // Send Data using POST
jehoon 0:e8b5220fd0c8 35 ifttt.addIngredients("Sending","POST","things");
jehoon 0:e8b5220fd0c8 36 ifttt.trigger(IFTTT_POST);
jehoon 0:e8b5220fd0c8 37
jehoon 0:e8b5220fd0c8 38 sock.close();
jehoon 0:e8b5220fd0c8 39 wizfi250.disconnect();
jehoon 0:e8b5220fd0c8 40
jehoon 0:e8b5220fd0c8 41 while(1) {
jehoon 0:e8b5220fd0c8 42 }
jehoon 0:e8b5220fd0c8 43 }
jehoon 0:e8b5220fd0c8 44