Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: IFTTT WIZnetInterface mbed
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 #include "TCPSocketConnection.h" 00004 #include "ifttt.h" 00005 00006 EthernetInterface eth; 00007 Serial pc(USBTX, USBRX); // tx, rx 00008 00009 int main() 00010 { 00011 int phy_link; 00012 pc.baud(115200); 00013 00014 printf("Wait a second...\r\n"); 00015 uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x01, 0x02}; 00016 eth.init(mac_addr); //Use DHCP 00017 eth.connect(); 00018 00019 do{ 00020 phy_link = eth.ethernet_link(); 00021 printf("..."); 00022 wait(2); 00023 }while(!phy_link); 00024 printf("\r\nIP Address is %s \r\n", eth.getIPAddress()); 00025 TCPSocketConnection sock; 00026 00027 // Initialize ifttt object, add up to 3 optional values, trigger event. 00028 IFTTT ifttt("YourEventName","ChangeToYourSecretKey", &sock); // EventName, Secret Key, socket to use 00029 ifttt.addIngredients("this is awesome","test-ing","data!!!"); // 3 optional Values to send along with trigger. 00030 ifttt.trigger(); 00031 00032 // Send data using GET 00033 ifttt.addIngredients("Sending","GET","data"); 00034 ifttt.trigger(IFTTT_GET); 00035 00036 // Send Data using POST 00037 ifttt.addIngredients("Sending","POST","things"); 00038 ifttt.trigger(IFTTT_POST); 00039 00040 sock.close(); 00041 eth.disconnect(); 00042 00043 while(1) { 00044 } 00045 }
Generated on Sun Jul 24 2022 03:26:02 by
1.7.2