Example program to use BMP085

Dependencies:   BMP085 mbed

Fork of Barometer-Example by silabs-abakurs

Revision:
0:bcb1988de877
Child:
1:9194c7303ad5
diff -r 000000000000 -r bcb1988de877 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 15 18:05:54 2015 +0000
@@ -0,0 +1,22 @@
+#include "BMP085.h"
+
+LowPowerTicker ticker;
+
+bool do_measurement = false;
+void measurement() {
+    do_measurement = true;
+}
+
+int main() {
+    BMP085 sensor(PD6, PD7, BMP085_MODE_HIGH_RESOLUTION);
+    ticker.attach(&measurement, 0.4);    
+    
+    while(1) {
+        sleep();
+        if(do_measurement) {
+            do_measurement = false;
+            sensor.measure();
+            printf("T: %6.2f, P: %6.4f\r\n  ", sensor.get_temperature(), sensor.get_pressure());
+        }
+    }
+}
\ No newline at end of file