projet capteur connecté ST/SE
Dependencies: HP206C mbed HMC5883L DHT DS1820
Revision 54:61d003e0754d, committed 2018-10-08
- Comitter:
- SBACCARI
- Date:
- Mon Oct 08 10:33:30 2018 +0000
- Parent:
- 53:a0752606d02c
- Child:
- 56:d9557c842d5d
- Child:
- 59:6d48aee9f7d5
- Commit message:
- v0.1 better commented
Changed in this revision
T_H_air.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/T_H_air.h Mon Oct 08 10:19:07 2018 +0000 +++ b/T_H_air.h Mon Oct 08 10:33:30 2018 +0000 @@ -2,9 +2,13 @@ #include "DHT.h" #include "config.h" /* ************************ MODE D'EMPLOI ***************************************************** - Ce fichier contient les fonction à piblier pour le capteur DHT22 - Pour la lecture des valeurs d'humidité et de la temprature un wait de 2s au minimum est necessaire - Il est a noté que le capteurs envoie parfois des valeurs nulles, ces valeur doivent etre exclu + This file contains functions to use with DHT22 sensor + Reading humidity and temperature values cannot be done simultaneously + At least 2s of wait time is needed between fetching the temprature value and the humidity value + Documentaation and biblipgraphy note that the sensor is slow and so values will have a delay of a few seconds compared to real life + +The following code works perfectly on its own : + airH = airHumidity(sensor); if( airH!=0){ pc.printf("H = %.2f pourcent \r\n", airH);
--- a/main.cpp Mon Oct 08 10:19:07 2018 +0000 +++ b/main.cpp Mon Oct 08 10:33:30 2018 +0000 @@ -27,25 +27,28 @@ 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); */ - //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); - pc.printf("\n=====| Data |=====\n"); tmpH = airHumidity(sensor); if( tmpH!=0){ airH = tmpH; - } - + } wait(2); - tmpT = airTemperature(sensor); if( tmpT!=0 ){ airT=tmpT; } + + // 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);