Mathieu Moneyron / Mbed 2 deprecated projetS1

Dependencies:   HP206C mbed HMC5883L DHT DS1820

main.cpp

Committer:
SBACCARI
Date:
2018-10-09
Revision:
71:b31e3ee29dd0
Parent:
69:9ad4bce37c63
Parent:
70:1e2e21c377ed
Child:
72:f678052af558

File content as of revision 71:b31e3ee29dd0:

#include "mbed.h"
#include "config.h"
#include "communication.h"
#include "T_H_air.h"
#include "T_H_soil.h"
#include "altitude.h"
#include "HMC5883L.h"


Serial wisol(SERIAL_PORT);
Serial pc(USBTX, USBRX);
DHT sensor(PIN_NAME, DHTtype);
HP20x_dev barometre(HP20X_I2C_PORT);
HMC5883L hmc5883(HMC5883_I2C_PORT);

int main() {
    barometre.reset();
    while(1) {
        float airH = 0,airT = 0;
        int16_t magXYZ[3];
        long P = 0;
        
        //collect data
        hmc5883.getXYZ(magXYZ);
        get_T_H_air(&airT, &airH, sensor); // takes 2s to execute
        P = pression(&barometre);
        
        // Display
        pc.printf("\n=====| Data |=====\n");
        pc.printf("H air : %.2f %%\r\n", airH);
        pc.printf("T air : %.2f C\r\n", airT);
        pc.printf("Pression : %ul Pa\r\n", P);
        pc.printf("Mag : X:%d ; Y:%d ; Z:%d\n", magXYZ[0], magXYZ[1], magXYZ[2]);
        wait(5);
    }
}