altb_pmic / Mbed 2 deprecated MS5611_2

Dependencies:   mbed

Revision:
0:7c23db660183
Child:
1:a94ff5f08fd7
diff -r 000000000000 -r 7c23db660183 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 18 14:23:41 2020 +0000
@@ -0,0 +1,34 @@
+/* MS5611 Pressure sensor example
+Aerodyne Labs
+2014
+ 
+This example uses the MS511 Library to read the temperature and pressure readings 
+from the MS5611 sensor.  It has been modified from the MS507 sensor library with 
+the different calculations that the MS5611 requires.  Otherwise, this library is
+identical to the MS5607
+*/
+#include "mbed.h"
+ 
+//Only uncomment the one needed.
+//#include "MS5611SPI.h"
+#include "MS5611I2C.h"
+ 
+Serial pc(USBTX, USBRX);                   // local terminal interface
+ 
+int main() {
+    pc.baud(115200);                        // set up USB serial speed
+    //Only uncomment the I2C or SPI version.
+    //MS5611SPI ms5611(p11, p12, p13, p10);
+    //MS5611I2C ms5611(p9, p10, false);
+    //PB_9 and PB_8 for Nucleo boards
+    I2C i2c(PB_3,PB_10);
+    MS5611I2C ms5611(i2c, false);
+    //Print the Coefficients from the 
+    ms5611.printCoefficients();
+    while(1){
+    printf("Pressure = %.0f Pa \r\n", ms5611.getPressure());
+    printf("Temperature = %.2f degC \r\n", ms5611.getTemperature());
+    printf("Altitude = %.2f m \r\n", ms5611.getAltitude());
+    wait(.5);
+    }
+}
\ No newline at end of file