Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HP206C mbed HMC5883L DHT DS1820
main.cpp
- Committer:
- SBACCARI
- Date:
- 2018-10-09
- Revision:
- 66:cbfcea17a3c5
- Parent:
- 65:3f898ad77cb5
- Child:
- 67:3ccbc6a532eb
File content as of revision 66:cbfcea17a3c5:
#include "mbed.h"
#include "config.h"
#include "communication.h"
#include "T_H_air.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() {
while(1) {
float airH = 0,airT = 0;
char *message;
int16_t magXYZ[3];
unsigned long alt;
long P = 0;
/*
read T&H air
read T sol
read H sol
read Pressure
read Magnetic
m = genMessage(T_air, H_air, T_sol, H_sol, Pressure, Mag)
sendMessage(m)
airH = airHumidity(sensor);
airT = airTemperature(sensor);
message = genMessage(airT, airH);
wisol.printf("AT$SF=%s\r\n", message);
*/
//collect data
//alt = readAltitude(&hp206c);
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 \%\n", airH);
pc.printf("T air : %.2f °C\n", airT);
pc.printf("altitude : %lu m\n", alt);
pc.printf("Mag : X:%d ; Y:%d ; Z:%d\n", magXYZ[0], magXYZ[1], magXYZ[2]);
wait(5);
}
}
