projet capteur connecté ST/SE
Dependencies: HP206C mbed HMC5883L DHT DS1820
Diff: altitude.cpp
- Revision:
- 75:9f6a6c7d4bea
- Parent:
- 70:1e2e21c377ed
- Child:
- 77:67faccef7f14
--- a/altitude.cpp Wed Oct 10 10:30:56 2018 +0000 +++ b/altitude.cpp Thu Oct 11 08:57:42 2018 +0000 @@ -3,13 +3,15 @@ long pression(HP20x_dev* barometre) { - long P = 0; - //barometre->reset(); - //pc.printf("SB, DEBUG : available? => %d \r\n", barometre->isAvailable() ); // DEBUG : show sensor status - wait(2); - P = barometre->ReadPressure(); - //pc.printf("P = %ul \r\n", P); // DEBUG : print pressure value - wait(3); - - return P; + char ret = barometre -> isAvailable(); + if (ret){ + long P = 0; + //barometre->reset(); + //pc.printf("SB, DEBUG : available? => %d \r\n", barometre->isAvailable() ); // DEBUG : show sensor status + wait(2); + P = barometre->ReadPressure(); + //pc.printf("P = %ul \r\n", P); // DEBUG : print pressure value + wait(3); + return P; + } } \ No newline at end of file