projet capteur connecté ST/SE
Dependencies: HP206C mbed HMC5883L DHT DS1820
Revision 63:769a0a65f5c7, committed 2018-10-09
- Comitter:
- SBACCARI
- Date:
- Tue Oct 09 12:29:13 2018 +0000
- Parent:
- 61:1104fcf792f3
- Parent:
- 62:d902b1e77094
- Child:
- 64:7adaa9dfcb8c
- Commit message:
- merge;
Changed in this revision
--- a/T_H_air.cpp Tue Oct 09 12:24:58 2018 +0000 +++ b/T_H_air.cpp Tue Oct 09 12:29:13 2018 +0000 @@ -25,4 +25,20 @@ return sensor.ReadTemperature(CELCIUS) ; } return 0; +} + +void get_T_H_air(int* T, int* H, DHT sensor) +{ + int tmpH, tmpT ; + + tmpT = airTemperature(sensor); + if( tmpT!=0 ) { + *T=tmpT; + } + wait(2); + + tmpH = airHumidity(sensor); + if( tmpH!=0) { + *H = tmpH; + } } \ No newline at end of file
--- a/T_H_air.h Tue Oct 09 12:24:58 2018 +0000 +++ b/T_H_air.h Tue Oct 09 12:29:13 2018 +0000 @@ -24,4 +24,5 @@ float airHumidity(DHT sensor); -float airTemperature(DHT sensor); \ No newline at end of file +float airTemperature(DHT sensor); +void get_T_H_air(int* T, int* H, DHT sensor); \ No newline at end of file
--- a/main.cpp Tue Oct 09 12:24:58 2018 +0000 +++ b/main.cpp Tue Oct 09 12:29:13 2018 +0000 @@ -14,7 +14,7 @@ int main() { while(1) { - float airH = 0, tmpH, tmpT, airT = 0; + float airH = 0,airT = 0; char *message; int16_t magXYZ[3]; unsigned long alt; @@ -37,15 +37,7 @@ //collect data alt = readAltitude(&hp206c); hmc5883.getXYZ(magXYZ); - tmpH = airHumidity(sensor); - if( tmpH!=0){ - airH = tmpH; - } - wait(2); - tmpT = airTemperature(sensor); - if( tmpT!=0 ){ - airT=tmpT; - } + get_T_H_air(&airT, &airH, sensor) // Display pc.printf("\n=====| Data |=====\n");