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
- Committer:
- thedude35
- Date:
- 2017-09-17
- Revision:
- 6:b59d85d0e67d
- Parent:
- 3:221997836268
File content as of revision 6:b59d85d0e67d:
#include "mbed.h" #include "EthernetInterface.h" #include "NTPClient.h" #include "TimeInterface.h" #include "rtos.h" #include "Timer.h" #include "mbed_events.h" #define SERVER_PORT 2073 #define RATE 10000 #define NOMINAL_R 350 //In Ohms #define GAUGE_FACTOR 2.1 #define CURRENT 2 //In amps int data = 711; //Example test data to be sent across the network int i = 0; char appbuffer[105]; //Application buffer int len = 105; //Length of the buffer float cycle_time; int p_press = 0; int id_press = 0; float p_strain = 0; float id_strain = 0; //int samples[]; void cycle_time_isr_rise(void); //ISR on the rising edge of the digital input starting the cycle timer and stopping the periodic reporting thread void cycle_time_isr_fall(void); //ISR on the falling edge of the digital input stopping the cycle timer and restarting the periodic reporting thread void idle_report(void); //sends the XML markup payload while the machine is idle float strainCalc(void); //Calculate the strain from the analog input signal received from the strain gauge