Gabriel Gibeau Sanchez / Mbed 2 deprecated Projet_S5_Mobile_local

Dependencies:   XBeeLib mbed-rtos mbed

Capteurs/Sensors.cpp

Committer:
ggs22
Date:
2017-12-04
Revision:
3:e76f0ece91ef
Child:
4:5fc4815b0583
Child:
5:2732931df96c
Child:
9:68575180c7a7

File content as of revision 3:e76f0ece91ef:

#include "Sensors.h"
#include "xbeeutils.h"

static Serial pc(USBTX,USBRX);

void calibrateSensors(){
    
    pc.printf("Calibrating sensors...\n");
    
    calibrate_EC();
    calibrate_RTD();
    //calibrate_PH();
    pc.printf("Calibration completed!\n");
}

char * getReadings(){
    
    char phBuf[DEFAULT_BUFFER_SIZE], ECBuf[DEFAULT_BUFFER_SIZE], RTDBuf[DEFAULT_BUFFER_SIZE], TxBuf[DEFAULT_BUFFER_SIZE];
    
    read_EC(ECBuf);
    read_RTD(RTDBuf);
    read_PH(phBuf);
        
     sprintf(TxBuf,"%s;%s;%s",RTDBuf,phBuf,ECBuf);
     pc.printf("%s\n",TxBuf);
     xbee_broadcast(TxBuf,strlen(TxBuf)+1);
     pc.printf("TxBuf strlen: %i\n",strlen(TxBuf));
}