1

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of IFTTT_Ethernet_Example by Austin Blackstone

Committer:
mbedAustin
Date:
Mon Jul 13 18:50:53 2015 +0000
Revision:
1:3010b44f07ff
Parent:
0:0f0676c43e4b
Child:
2:678f949dccd7
Changed to use IFTTT library instead of http library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 0:0f0676c43e4b 1 #include "mbed.h"
mbedAustin 0:0f0676c43e4b 2 #include "EthernetInterface.h"
mbedAustin 1:3010b44f07ff 3 #include "TCPSocketConnection.h"
mbedAustin 1:3010b44f07ff 4 #include "ifttt.h"
mbedAustin 1:3010b44f07ff 5
mbedAustin 0:0f0676c43e4b 6 EthernetInterface eth;
mbedAustin 1:3010b44f07ff 7 RawSerial pc(USBTX, USBRX); // tx, rx
mbedAustin 0:0f0676c43e4b 8
mbedAustin 1:3010b44f07ff 9 int main()
mbedAustin 0:0f0676c43e4b 10 {
mbedAustin 1:3010b44f07ff 11 pc.baud(9600);
mbedAustin 0:0f0676c43e4b 12 eth.init(); //Use DHCP
mbedAustin 0:0f0676c43e4b 13 eth.connect();
mbedAustin 0:0f0676c43e4b 14 printf("IP Address is %s \n\r", eth.getIPAddress());
mbedAustin 1:3010b44f07ff 15 TCPSocketConnection socket;
mbedAustin 1:3010b44f07ff 16
mbedAustin 1:3010b44f07ff 17 // Initialize ifttt object, add up to 3 optional values, trigger event.
mbedAustin 1:3010b44f07ff 18 IFTTT ifttt("YourEventName","ChangeToYourSecretKey", &socket); // EventName, Secret Key, socket to use
mbedAustin 1:3010b44f07ff 19 ifttt.addIngredients("this is awesome","test-ing","data!!!"); // 3 optional Values to send along with trigger.
mbedAustin 1:3010b44f07ff 20 ifttt.trigger();
mbedAustin 1:3010b44f07ff 21
mbedAustin 1:3010b44f07ff 22 // Send data using GET
mbedAustin 1:3010b44f07ff 23 ifttt.addIngredients("Sending","GET","data");
mbedAustin 1:3010b44f07ff 24 ifttt.trigger(IFTTT_GET);
mbedAustin 1:3010b44f07ff 25
mbedAustin 1:3010b44f07ff 26 // Send Data using POST
mbedAustin 1:3010b44f07ff 27 ifttt.addIngredients("Sending","POST","things");
mbedAustin 1:3010b44f07ff 28 ifttt.trigger(IFTTT_POST);
mbedAustin 1:3010b44f07ff 29
mbedAustin 1:3010b44f07ff 30 eth.disconnect();
mbedAustin 0:0f0676c43e4b 31 while(1) {
mbedAustin 0:0f0676c43e4b 32 }
mbedAustin 0:0f0676c43e4b 33 }