Public Repository for IoT demo, leveraging the FRDM-K64F, WNC Cellular Modem, and AT&T M2X platform. Expects GPIO input from a sensor to send a discrete value to M2X.
Dependencies: ConfigFile M2XStreamClient-JMF PinDetect SDFileSystem WNCInterface jsonlite mbed-rtos mbed
Fork of SVP_IoT_M2X_Cellular by
Diff: main.cpp
- Revision:
- 11:dc15a7897495
- Parent:
- 10:6d7e4693dff7
--- a/main.cpp Thu Mar 02 18:04:49 2017 +0000 +++ b/main.cpp Mon Apr 10 20:18:23 2017 +0000 @@ -27,9 +27,6 @@ SDFileSystem local(PTE3, PTE1, PTE2, PTE4, "local"); ConfigFile cfg; -//char deviceId[] = "3263056a467bc4eacd787bb0af9c1ad6"; // Device you want to post to -//char m2xKey[] = "0aad274b67c7faa8110769ae9d739033"; // Your M2X API Key or Master API Key - char fromTime[]= "1969-12-31T19:00:01.000Z"; // yyyy-mm-ddTHH:MM:SS.SSSZ char endTime[25]; @@ -127,7 +124,7 @@ if(response){ eth.doDebug(0); - SetLedColor(2); + SetLedColor(5); }; response = eth.connect(); @@ -154,10 +151,6 @@ int main() { - - - //char deviceId[] = "3263056a467bc4eacd787bb0af9c1ad6"; // Device you want to post to - //char m2xKey[] = "0aad274b67c7faa8110769ae9d739033"; // Your M2X API Key or Master API Key pc.baud(115200); pc.printf("Hello World! I am here!" CRLF); @@ -272,9 +265,9 @@ m2xOnline = 0; SetLedColor(2); pc.printf("Error connecting to M2X" CRLF); - wait(5); //pc.printf("IP Address: %s " CRLF CRLF, eth.getIPAddress()); if (m2xresponse == -1){ + SetLedColor(0); pc.printf("Modem Error - attempting to reconnect" CRLF); initModem(); initM2X(); @@ -287,9 +280,9 @@ m2xOnline = m2xOnline++; } timeService.getTimestamp(timestamp, &length); - pc.printf("Thats all folks, got to wait 5 seconds... (%s)" CRLF CRLF CRLF, timestamp); + pc.printf("Thats all folks, got to wait 1 second... (%s)" CRLF CRLF CRLF, timestamp); - // wait 5 secs and then loop + // wait 1 secs and then loop delay(1000); } } \ No newline at end of file