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
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 #include "NTPClient.h" 00004 #include "TimeInterface.h" 00005 #include "rtos.h" 00006 #include "Timer.h" 00007 #include "mbed_events.h" 00008 #define SERVER_PORT 7 00009 #define RATE 10000 00010 #define NOMINAL_R 350 //In Ohms 00011 #define GAUGE_FACTOR 2.1 00012 #define CURRENT 2 //In amps 00013 00014 int data = 711; //Example test data to be sent across the network 00015 int i = 0; 00016 char appbuffer[105]; //Application buffer 00017 int len = 105; //Length of the buffer 00018 float cycle_time; //Drum crushing cycle time 00019 int p_press = 0; 00020 int id_press = 0; 00021 float p_strain = 0; //Peak strain 00022 float id_strain = 0; //Idle stain 00023 int eth_cxn_status; //Ethernet connection status 00024 00025 00026 //int samples[]; 00027 00028 void cycle_time_isr_rise(void); 00029 //ISR on the rising edge of the digital input starting the cycle timer and stopping the periodic reporting thread 00030 00031 void cycle_time_isr_fall(void); 00032 //ISR on the falling edge of the digital input stopping the cycle timer and restarting the periodic reporting thread 00033 00034 void idle_report(void); 00035 //sends the XML markup payload report while the machine is idle 00036 00037 float strainCalc(void); 00038 //Calculate the strain from the analog input signal received from the strain gauge 00039 00040
Generated on Wed Jul 20 2022 12:19:43 by 1.7.2