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:
- 55:887edb961698
- Parent:
- 53:a0752606d02c
- Child:
- 56:d9557c842d5d
--- a/main.cpp Mon Oct 08 10:19:07 2018 +0000
+++ b/main.cpp Tue Oct 09 11:37:37 2018 +0000
@@ -9,12 +9,12 @@
Serial wisol(SERIAL_PORT);
Serial pc(USBTX, USBRX);
DHT sensor(PIN_NAME, DHTtype);
-I2C hp206c(HP20X_I2C_PORT);
+HP20x_dev hp206c(HP20X_I2C_PORT);
HMC5883L hmc5883(HMC5883_I2C_PORT);
int main() {
while(1) {
- float airH, tmpH, tmpT, airT;
+ float airH = 0, tmpH, tmpT, airT = 0;
char *message;
int16_t magXYZ[3];
unsigned long alt;
@@ -34,18 +34,18 @@
//wisol.printf("AT$SF=%s\r\n", message);
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);
