An embedded server sending sensor information over the network to a remote client side process parsing the data
Dependencies: EthernetInterface NTPClient TimeInterface WebSocketClient mbed-rtos mbed ST_Events-old
Revision 8:e16130691c3b, committed 2017-09-17
- Comitter:
- thedude35
- Date:
- Sun Sep 17 22:00:00 2017 +0000
- Branch:
- USB-logging
- Parent:
- 7:e9d4a4972e50
- Commit message:
- Syntax cleanup
Changed in this revision
data_logger.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/data_logger.cpp Sun Sep 17 17:43:20 2017 -0400 +++ b/data_logger.cpp Sun Sep 17 22:00:00 2017 +0000 @@ -47,12 +47,10 @@ { printf("Unable to set time, error\r\n"); } - }; + } else { printf("Entering USB logging mode"); - }; - - printf("board is up"); + } timestamp = time(NULL); queue1.call_every(RATE,&idle_report); @@ -79,12 +77,12 @@ t.stop(); //Stop the timer cycle_time = t.read(); t.reset(); //reset the timer - if(eth_cxn_status) == 0 { + if(eth_cxn_status == 0) { sprintf(appbuffer,"<payload><time>%s</time><cy_time>%f</cy_time><p_strain>%f</p_strain></payload>",time_b.ctime(×tamp), cycle_time, p_strain); - }; + } else { printf("Cycle time is: %f \n Strain detected during cycle is: %f% \r", cycle_time, p_strain); - }; + } sprintf(appbuffer,"\0"); //Nullify the string m.unlock(); //Unlock the mutex }; @@ -92,12 +90,12 @@ void idle_report(void) { m.lock(); //Attempt to lock the mutex here id_strain = strainCalc(); //Calculate strain while the machine is idle - if (eth_cxn_status) == 0 { //Log data based on the available connection + if (eth_cxn_status == 0) { //Log data based on the available connection sprintf(appbuffer,"<payload><time>%s</time><id_strain>%f</id_strain></payload>",time_b.ctime(×tamp), id_strain); } else { printf("Strain while machine is idle: %f%",id_strain ); - }; + } sprintf(appbuffer,"\0"); //Nullify the buffer m.unlock(); //Unlock the mutex