1

Dependencies:   EthernetInterface IFTTT mbed-rtos mbed

Fork of IFTTT_Ethernet_Example by Austin Blackstone

Committer:
yu10078999
Date:
Fri Sep 09 13:14:00 2016 +0000
Revision:
2:6ef0af7c37d6
Parent:
1:3010b44f07ff
0

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);
yu10078999 2:6ef0af7c37d6 12 EthernetInterface eth;
mbedAustin 0:0f0676c43e4b 13 eth.connect();
yu10078999 2:6ef0af7c37d6 14 wait(0.5);
mbedAustin 0:0f0676c43e4b 15 printf("IP Address is %s \n\r", eth.getIPAddress());
mbedAustin 1:3010b44f07ff 16 TCPSocketConnection socket;
mbedAustin 1:3010b44f07ff 17
mbedAustin 1:3010b44f07ff 18 // Initialize ifttt object, add up to 3 optional values, trigger event.
yu10078999 2:6ef0af7c37d6 19 IFTTT ifttt("OWJMAN","bkJhw8soKcjx28zrqAgeW2", &socket); // EventName, Secret Key, socket to use
mbedAustin 1:3010b44f07ff 20 ifttt.addIngredients("this is awesome","test-ing","data!!!"); // 3 optional Values to send along with trigger.
mbedAustin 1:3010b44f07ff 21 ifttt.trigger();
mbedAustin 1:3010b44f07ff 22
mbedAustin 1:3010b44f07ff 23 // Send data using GET
mbedAustin 1:3010b44f07ff 24 ifttt.addIngredients("Sending","GET","data");
mbedAustin 1:3010b44f07ff 25 ifttt.trigger(IFTTT_GET);
mbedAustin 1:3010b44f07ff 26
mbedAustin 1:3010b44f07ff 27 // Send Data using POST
mbedAustin 1:3010b44f07ff 28 ifttt.addIngredients("Sending","POST","things");
mbedAustin 1:3010b44f07ff 29 ifttt.trigger(IFTTT_POST);
mbedAustin 1:3010b44f07ff 30
mbedAustin 1:3010b44f07ff 31 eth.disconnect();
mbedAustin 0:0f0676c43e4b 32 }