add messages print out.
Dependencies: EthernetInterface IFTTT mbed-rtos mbed
Fork of IFTTT_Ethernet_Example by
Revision 3:34f1df7fd14c, committed 2016-09-11
- Comitter:
- liutaitsung
- Date:
- Sun Sep 11 04:57:14 2016 +0000
- Parent:
- 2:22857c849884
- Commit message:
- add messages print out.
Changed in this revision
IFTTT.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 22857c849884 -r 34f1df7fd14c IFTTT.lib --- a/IFTTT.lib Sat Sep 10 12:12:50 2016 +0000 +++ b/IFTTT.lib Sun Sep 11 04:57:14 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mbedAustin/code/IFTTT/#c916e13a269a +https://developer.mbed.org/users/mbedAustin/code/IFTTT/#935972c2f628
diff -r 22857c849884 -r 34f1df7fd14c main.cpp --- a/main.cpp Sat Sep 10 12:12:50 2016 +0000 +++ b/main.cpp Sun Sep 11 04:57:14 2016 +0000 @@ -1,17 +1,55 @@ +// +// +// + #include "mbed.h" #include "EthernetInterface.h" #include "TCPSocketConnection.h" #include "ifttt.h" +// +// +// + EthernetInterface eth; + RawSerial pc(USBTX, USBRX); // tx, rx int main() { pc.baud(9600); - eth.init(); //Use DHCP - eth.connect(); + + pc.printf("\n"); + pc.printf("\n"); + pc.printf("--------------------------------\n"); + pc.printf("Program starts ...\n"); + +// eth.init(); //Use DHCP + int init_rtn = eth.init(); //Use DHCP + + pc.printf("init() return : %d\n", init_rtn); + + pc.printf("\n"); + pc.printf(" wait for ethernet connect()......\n"); + pc.printf("\n"); + + +// eth.connect(); + int connect_rtn = eth.connect(); + pc.printf("connect() return : %d\n", connect_rtn); + printf("IP Address is %s \n\r", eth.getIPAddress()); + + pc.printf("IP Address is %s\n", eth.getMACAddress()); + pc.printf("\n"); + + + + + pc.printf("wait for socket server, 15 second ....\n"); + pc.printf("\n"); + + TCPSocketConnection socket; // Initialize ifttt object, add up to 3 optional values, trigger event. @@ -31,3 +69,14 @@ while(1) { } } + +// override the default weak function to provide a specific mac address +extern "C" void mbed_mac_address(char *mac) +{ + mac[0] = 0x00; + mac[1] = 0x50; + mac[2] = 0x56; + mac[3] = 0xC0; + mac[4] = 0x00; + mac[5] = 0xAB; +};