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
Diff: main.cpp
- Revision:
- 71:b31e3ee29dd0
- Parent:
- 69:9ad4bce37c63
- Parent:
- 70:1e2e21c377ed
- Child:
- 72:f678052af558
diff -r 9ad4bce37c63 -r b31e3ee29dd0 main.cpp
--- a/main.cpp Tue Oct 09 15:28:58 2018 +0000
+++ b/main.cpp Tue Oct 09 15:35:04 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);
}
