Mathieu Moneyron / Mbed 2 deprecated projetS1

Dependencies:   HP206C mbed HMC5883L DHT DS1820

Committer:
SBACCARI
Date:
Tue Oct 09 12:27:17 2018 +0000
Revision:
62:d902b1e77094
Parent:
56:d9557c842d5d
Child:
64:7adaa9dfcb8c
function get_T_H_air in T_H_air.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MathieuM 0:fa6e7dd26ef2 1 #include "mbed.h"
MathieuM 45:60f602ecd59b 2 #include "config.h"
MathieuM 45:60f602ecd59b 3 #include "communication.h"
MathieuM 46:40b6bbf6167e 4 #include "T_H_air.h"
MathieuM 49:b1ac7ebb715f 5 #include "altitude.h"
MathieuM 52:d49b6f468b97 6 #include "HMC5883L.h"
MathieuM 49:b1ac7ebb715f 7
MathieuM 0:fa6e7dd26ef2 8
MathieuM 45:60f602ecd59b 9 Serial wisol(SERIAL_PORT);
MathieuM 49:b1ac7ebb715f 10 Serial pc(USBTX, USBRX);
MathieuM 46:40b6bbf6167e 11 DHT sensor(PIN_NAME, DHTtype);
MathieuM 55:887edb961698 12 HP20x_dev hp206c(HP20X_I2C_PORT);
MathieuM 52:d49b6f468b97 13 HMC5883L hmc5883(HMC5883_I2C_PORT);
MathieuM 0:fa6e7dd26ef2 14
MathieuM 0:fa6e7dd26ef2 15 int main() {
MathieuM 0:fa6e7dd26ef2 16 while(1) {
SBACCARI 62:d902b1e77094 17 float airH = 0,airT = 0;
MathieuM 46:40b6bbf6167e 18 char *message;
MathieuM 52:d49b6f468b97 19 int16_t magXYZ[3];
MathieuM 52:d49b6f468b97 20 unsigned long alt;
MathieuM 33:2a6476c33e74 21 /*
MathieuM 33:2a6476c33e74 22 read T&H air
MathieuM 33:2a6476c33e74 23 read T sol
MathieuM 33:2a6476c33e74 24 read H sol
MathieuM 33:2a6476c33e74 25 read Pressure
MathieuM 33:2a6476c33e74 26 read Magnetic
MathieuM 33:2a6476c33e74 27
MathieuM 33:2a6476c33e74 28 m = genMessage(T_air, H_air, T_sol, H_sol, Pressure, Mag)
MathieuM 33:2a6476c33e74 29 sendMessage(m)
SBACCARI 54:61d003e0754d 30
SBACCARI 54:61d003e0754d 31 airH = airHumidity(sensor);
SBACCARI 54:61d003e0754d 32 airT = airTemperature(sensor);
SBACCARI 54:61d003e0754d 33 message = genMessage(airT, airH);
SBACCARI 54:61d003e0754d 34 wisol.printf("AT$SF=%s\r\n", message);
MathieuM 33:2a6476c33e74 35 */
SBACCARI 54:61d003e0754d 36
SBACCARI 54:61d003e0754d 37 //collect data
MathieuM 52:d49b6f468b97 38 alt = readAltitude(&hp206c);
MathieuM 52:d49b6f468b97 39 hmc5883.getXYZ(magXYZ);
SBACCARI 62:d902b1e77094 40 get_T_H_air(&airT, &airH, sensor)
MathieuM 55:887edb961698 41
MathieuM 55:887edb961698 42 // Display
MathieuM 55:887edb961698 43 pc.printf("\n=====| Data |=====\n");
MathieuM 53:a0752606d02c 44 pc.printf("H air : %.2f \%\n", airH);
MathieuM 53:a0752606d02c 45 pc.printf("T air : %.2f °C\n", airT);
MathieuM 53:a0752606d02c 46 pc.printf("altitude : %lu m\n", alt);
MathieuM 52:d49b6f468b97 47 pc.printf("Mag : X:%d ; Y:%d ; Z:%d\n", magXYZ[0], magXYZ[1], magXYZ[2]);
MathieuM 53:a0752606d02c 48 wait(5);
MathieuM 0:fa6e7dd26ef2 49 }
MathieuM 0:fa6e7dd26ef2 50 }