Jeff Chen / Mbed 2 deprecated IFTTT_Ethernet_Example

Dependencies:   EthernetInterface IFTTT mbed-rtos mbed

Fork of IFTTT_Ethernet_Example by Austin Blackstone

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "EthernetInterface.h"
00003 #include "TCPSocketConnection.h"
00004 #include "ifttt.h"
00005 
00006 EthernetInterface eth;
00007 RawSerial pc(USBTX, USBRX); // tx, rx
00008 
00009 int main()
00010 {
00011     pc.baud(9600);
00012     eth.init(); //Use DHCP
00013     eth.connect();
00014     printf("IP Address is %s \n\r", eth.getIPAddress());
00015     TCPSocketConnection socket;
00016 
00017     // Initialize ifttt object, add up to 3 optional values, trigger event.
00018     IFTTT ifttt("hellowordmbed","ExqSjQiwzZINRMFTOgo--", &socket); // EventName, Secret Key, socket to use
00019     ifttt.addIngredients("this is awesome","test-ing","data!!!");     // 3 optional Values to send along with trigger.
00020     ifttt.trigger();
00021 
00022     // Send data using GET
00023     ifttt.addIngredients("Sending","GET","data");
00024     ifttt.trigger(IFTTT_GET);
00025 
00026     // Send Data using POST
00027     ifttt.addIngredients("Sending","POST","things");
00028     ifttt.trigger(IFTTT_POST);
00029 
00030     eth.disconnect();
00031     while(1) {
00032     }
00033 }