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.
Diff: main.cpp
- Revision:
- 3:aa6c88a89226
- Parent:
- 2:ecd5c6118888
- Child:
- 4:cdf9641ba817
--- a/main.cpp Tue Jun 25 13:20:42 2019 +0000 +++ b/main.cpp Tue Jun 25 13:41:05 2019 +0000 @@ -2,21 +2,16 @@ #include "HP206C.h" Serial serial(SERIAL_TX, SERIAL_RX); -HP206C barometer(D14, D15); -float temperature = 0.0f; -float pressure = 0.0f; +HP206C barometer(D14, D15); float altitude = 0.0f; int main() { serial.baud(115200); barometer.reset(); - while(1) - { - if (baro_found) { - //serial.printf("temperature %f, pressure %f, altitude %f\r\n", temperature, pressure, altitude); - serial.printf("altitude %f\r\n", altitude); - wait_ms(10); // don't hammer the serial console - } + while(1) { + altitude = barometer.measureAndreadAltitude(); + serial.printf("altitude %f\r\n", altitude); + wait_ms(10); // don't hammer the serial console } }