This example codes uses the wolfssl library to get hastags from Twitter by using the FRDM-K64F board from Freescale
Dependencies: EthernetInterface-FRDM HTTPClient mbed-rtos mbed wolfSSL WDT_K64F
Fork of SimpleHTTPSClient by
Revision 7:dceeeeca2741, committed 2015-08-06
- Comitter:
- lgarabo
- Date:
- Thu Aug 06 00:39:07 2015 +0000
- Parent:
- 6:bd28d1ad3ced
- Commit message:
- Added watchdog timer for 60 seconds. This prevents to stuck when HTTPS doesn't answer.
Changed in this revision
WDT_K64F.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 bd28d1ad3ced -r dceeeeca2741 WDT_K64F.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WDT_K64F.lib Thu Aug 06 00:39:07 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/loopsva/code/WDT_K64F/#70e99b5845fd
diff -r bd28d1ad3ced -r dceeeeca2741 main.cpp --- a/main.cpp Thu Aug 06 00:09:19 2015 +0000 +++ b/main.cpp Thu Aug 06 00:39:07 2015 +0000 @@ -1,10 +1,12 @@ #include "mbed.h" #include "EthernetInterface.h" #include "HTTPClient.h" +#include "Watchdog.h" EthernetInterface eth; HTTPClient http; DigitalOut led1(LED1); +Watchdog wdt; char recvBuff[1024*40]; @@ -44,7 +46,9 @@ char createDate[11] = {0}; unsigned long long dataTime = 0; unsigned long long lastdataTime = 1438467674; - + + wdt.kick(60); //init the watchdog for a 60 second timeout + eth.init(); //Use DHCP printf("HTTPS Client, Starting,...\n\r") ; @@ -69,6 +73,7 @@ if (lastdataTime < dataTime) { //Give the candy here!! + printf("\n\rGiving a candy!!\n\r"); led1 = 0; lastdataTime = dataTime; wait(1); @@ -77,7 +82,8 @@ } else { printf("Error - ret = %d - HTTP return code = %d\n\r", ret, http.getHTTPResponseCode()); } - wait(30); + wait(15); + wdt.kick(); //kick the watchdog before 60 seconds is up } eth.disconnect(); }