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
data_logger.h@8:e16130691c3b, 2017-09-17 (annotated)
- Committer:
- thedude35
- Date:
- Sun Sep 17 22:00:00 2017 +0000
- Branch:
- USB-logging
- Revision:
- 8:e16130691c3b
- Parent:
- 7:e9d4a4972e50
Syntax cleanup
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedude35 | 2:5c9125d3ddae | 1 | #include "mbed.h" |
thedude35 | 2:5c9125d3ddae | 2 | #include "EthernetInterface.h" |
thedude35 | 2:5c9125d3ddae | 3 | #include "NTPClient.h" |
thedude35 | 2:5c9125d3ddae | 4 | #include "TimeInterface.h" |
thedude35 | 2:5c9125d3ddae | 5 | #include "rtos.h" |
thedude35 | 2:5c9125d3ddae | 6 | #include "Timer.h" |
thedude35 | 2:5c9125d3ddae | 7 | #include "mbed_events.h" |
thedude35 | 2:5c9125d3ddae | 8 | #define SERVER_PORT 7 |
thedude35 | 2:5c9125d3ddae | 9 | #define RATE 10000 |
thedude35 | 3:221997836268 | 10 | #define NOMINAL_R 350 //In Ohms |
thedude35 | 3:221997836268 | 11 | #define GAUGE_FACTOR 2.1 |
thedude35 | 3:221997836268 | 12 | #define CURRENT 2 //In amps |
thedude35 | 2:5c9125d3ddae | 13 | |
thedude35 | 3:221997836268 | 14 | int data = 711; //Example test data to be sent across the network |
thedude35 | 2:5c9125d3ddae | 15 | int i = 0; |
thedude35 | 3:221997836268 | 16 | char appbuffer[105]; //Application buffer |
thedude35 | 3:221997836268 | 17 | int len = 105; //Length of the buffer |
thedude35 | 7:e9d4a4972e50 | 18 | float cycle_time; //Drum crushing cycle time |
thedude35 | 2:5c9125d3ddae | 19 | int p_press = 0; |
thedude35 | 2:5c9125d3ddae | 20 | int id_press = 0; |
thedude35 | 7:e9d4a4972e50 | 21 | float p_strain = 0; //Peak strain |
thedude35 | 7:e9d4a4972e50 | 22 | float id_strain = 0; //Idle stain |
thedude35 | 7:e9d4a4972e50 | 23 | int eth_cxn_status; //Ethernet connection status |
thedude35 | 3:221997836268 | 24 | |
thedude35 | 2:5c9125d3ddae | 25 | |
thedude35 | 2:5c9125d3ddae | 26 | //int samples[]; |
thedude35 | 2:5c9125d3ddae | 27 | |
thedude35 | 2:5c9125d3ddae | 28 | void cycle_time_isr_rise(void); |
thedude35 | 2:5c9125d3ddae | 29 | //ISR on the rising edge of the digital input starting the cycle timer and stopping the periodic reporting thread |
thedude35 | 2:5c9125d3ddae | 30 | |
thedude35 | 2:5c9125d3ddae | 31 | void cycle_time_isr_fall(void); |
thedude35 | 2:5c9125d3ddae | 32 | //ISR on the falling edge of the digital input stopping the cycle timer and restarting the periodic reporting thread |
thedude35 | 2:5c9125d3ddae | 33 | |
thedude35 | 3:221997836268 | 34 | void idle_report(void); |
thedude35 | 7:e9d4a4972e50 | 35 | //sends the XML markup payload report while the machine is idle |
thedude35 | 3:221997836268 | 36 | |
thedude35 | 3:221997836268 | 37 | float strainCalc(void); |
thedude35 | 3:221997836268 | 38 | //Calculate the strain from the analog input signal received from the strain gauge |
thedude35 | 3:221997836268 | 39 | |
thedude35 | 3:221997836268 | 40 |