![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.
Dependencies: mbed FXOS8700CQ MODSERIAL
Diff: main.cpp
- Revision:
- 53:dcccf2881fa0
- Parent:
- 52:9dafcb7f320f
- Child:
- 55:3abf9e3f42e6
--- a/main.cpp Sun Jul 24 22:10:12 2016 +0000 +++ b/main.cpp Tue Jul 26 20:32:00 2016 +0000 @@ -1,4 +1,4 @@ -#include "mbed.h" + #include "mbed.h" #include <cctype> #include <string> #include "SerialBuffered.h" @@ -173,7 +173,7 @@ //When enabled, there will be no changes in these 4 pins... shield_3v3_1v8_sig_trans_ena = 1; - // Now, give the modem 60 secons to start responding by + // Now, give the modem 60 seconds to start responding by // sending simple 'AT' commands to modem once per second. Timer timer; timer.start(); @@ -243,7 +243,7 @@ } return MDM_ERR_TIMEOUT; } - pc.printf("D %s",rsp); + return MDM_OK; } @@ -499,13 +499,17 @@ if (bTimerExpiredFlag) { bTimerExpiredFlag = false; + puts("HTS221 START\r\n"); sprintf(SENSOR_DATA.Temperature, "%0.2f", CTOF(hts221.readTemperature())); sprintf(SENSOR_DATA.Humidity, "%02d", hts221.readHumidity()); + puts("READ OTHER SENSORS START\r\n"); read_sensors(); //read available external sensors from a PMOD and the on-board motion sensor char modem_string[512]; + puts("GENERATE MODEM STRING\r\n"); GenerateModemString(&modem_string[0]); printf(BLU "\r\nSending to modem : %s" DEF "\r\n", modem_string); sockwrite_mdm(modem_string); + printf("READ START\r\n"); if (sockread_mdm(&MySocketData, 1024, 20)) { // If any non-zero response from server, make it GREEN one-time @@ -520,10 +524,13 @@ char stringToCharBuf[BUF_SIZE_FOR_N_MAX_SOCKREAD*MAX_WNC_SOCKREAD_PAYLOAD+1]; // WNC can return max of 1500 (per sockread) if ((MySocketData.length() + 1) < sizeof(stringToCharBuf)) { + puts("STRING COPY\r\n"); strcpy(stringToCharBuf, MySocketData.c_str()); + puts("EXTRACT JSON\r\n"); if (extract_JSON(stringToCharBuf, &myJsonResponse[0])) { printf(GRN "JSON : %s" DEF "\n", &myJsonResponse[0]); + puts("PARSE JSON\r\n"); parse_JSON(&myJsonResponse[0]); } } @@ -534,6 +541,7 @@ { printf(RED "No response..." DEF "\r\n"); } + puts("SOCKREAD DONE\r\n"); } //bTimerExpiredFlag } //forever loop }