projet capteur connecté ST/SE
Dependencies: HP206C mbed HMC5883L DHT DS1820
Revision 70:1e2e21c377ed, committed 2018-10-09
- Comitter:
- SBACCARI
- Date:
- Tue Oct 09 15:33:37 2018 +0000
- Parent:
- 67:3ccbc6a532eb
- Child:
- 71:b31e3ee29dd0
- Commit message:
- Pression, T_H_air, Mag en bon fonctionnement
Changed in this revision
altitude.cpp | 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/altitude.cpp Tue Oct 09 15:14:35 2018 +0000 +++ b/altitude.cpp Tue Oct 09 15:33:37 2018 +0000 @@ -4,8 +4,8 @@ long pression(HP20x_dev* barometre) { long P = 0; - barometre->reset(); - //pc.printf("SB : available? => %d \r\n", barometre.isAvailable() ); // DEBUG : show sensor status + //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
--- a/main.cpp Tue Oct 09 15:14:35 2018 +0000 +++ b/main.cpp Tue Oct 09 15:33:37 2018 +0000 @@ -12,51 +12,24 @@ DHT sensor(PIN_NAME, DHTtype); HP20x_dev barometre(HP20X_I2C_PORT); HMC5883L hmc5883(HMC5883_I2C_PORT); -DS1820 probe(SOIL_T_PIN); -AnalogIn humidSensor(SOIL_H_PIN); int main() { - if(initSoilTemp(probe,PA_5)) - pc.printf("unassigned Probe\r\n"); - float airValue(AIR_SOIL_HUMIDITY); - float waterValue(WATER_SOIL_HUMIDITY); + barometre.reset(); while(1) { float airH = 0,airT = 0; int16_t magXYZ[3]; 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 hmc5883.getXYZ(magXYZ); get_T_H_air(&airT, &airH, sensor); // takes 2s to execute P = pression(&barometre); - float soilH = getSoilHumidity( humidSensor, airValue,waterValue, true); - float soilT = getSoilTemperature(probe); - - if(soilT == DS1820::invalid_conversion) - pc.printf("Error with soil temperature probe : not connected\n\r"); // Display pc.printf("\n=====| Data |=====\n"); pc.printf("H air : %.2f %%\r\n", airH); - pc.printf("T air : %.2f oC\r\n", airT); - pc.printf("H soil : %.2f %%\r\n", soilH); - pc.printf("T soil : %.2f oC\r\n", soilT); - pc.printf("Pression : %lu m\n", P); + pc.printf("T air : %.2f C\r\n", airT); + pc.printf("Pression : %ul Pa\r\n", P); pc.printf("Mag : X:%d ; Y:%d ; Z:%d\n", magXYZ[0], magXYZ[1], magXYZ[2]); wait(5); }