Mbed Tigger IFTTT Send A Mail

Dependencies:   EthernetInterface IFTTT mbed-rtos mbed

Fork of IFTTT_Ethernet_Example by Austin Blackstone

Committer:
Jeffdhyan
Date:
Sat Sep 10 12:12:50 2016 +0000
Revision:
2:22857c849884
Parent:
1:3010b44f07ff
EtherNet to IFTTT Send  a Mail

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.
Jeffdhyan 2:22857c849884 18 IFTTT ifttt("hellowordmbed","ExqSjQiwzZINRMFTOgo--", &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 }