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
Branch:
USB-logging
Revision:
8:e16130691c3b
Parent:
7:e9d4a4972e50

File content as of revision 8:e16130691c3b:

#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 7
#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;						//Drum crushing cycle time
int p_press = 0;
int id_press = 0;
float p_strain = 0;						//Peak strain
float id_strain = 0;					//Idle stain
int eth_cxn_status;						//Ethernet connection status


//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 report while the machine is idle

float strainCalc(void);
//Calculate the strain from the analog input signal received from the strain gauge