Interface with the If This Then That (IFTTT). This example uses both POST and GET to interface with IFTTT. Up to 3 values can be sent along with the trigger event name.

Dependencies:   ESP8266Interface IFTTT mbed

Fork of IFTTT_Ethernet_Example by Austin Blackstone

main.cpp

Committer:
mbedAustin
Date:
2016-01-03
Revision:
4:3c8b0feb18e4
Parent:
1:15dd4d0a3af0

File content as of revision 4:3c8b0feb18e4:

#include "mbed.h"
#include "ESP8266Interface.h"
#include "TCPSocketConnection.h"
#include "ifttt.h"

ESP8266Interface wifi(D1,D0,D2,"ssid","passkey",115200); // TX,RX,Reset,SSID,Password,Baud
RawSerial pc(USBTX, USBRX); // tx, rx

int main()
{
    pc.baud(9600);
    wifi.init(); //Reset
    wifi.connect(); //Use DHCP
    printf("IP Address is %s \n\r", wifi.getIPAddress());
    TCPSocketConnection socket;
    
    // Initialize ifttt object, add up to 3 optional values, trigger event. 
    IFTTT ifttt("YourEventName","ChangeToYourSecretKey", &socket); // EventName, Secret Key, socket to use
    ifttt.addIngredients("this is awesome","test-ing","data!!!");     // 3 optional Values to send along with trigger.
    ifttt.trigger();

    ifttt.addIngredients("Sending","GET","data");
    ifttt.trigger(IFTTT_GET);

    ifttt.addIngredients("Sending","POST","things");
    ifttt.trigger(IFTTT_POST);
    while(1) {
    }
}