altb_pmic / Mbed 2 deprecated MS5611_2

Dependencies:   mbed

Committer:
altb2
Date:
Tue Feb 18 14:23:41 2020 +0000
Revision:
0:7c23db660183
Child:
1:a94ff5f08fd7
MS5611 Barometer, connections for hene-nucleo_Adapter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
altb2 0:7c23db660183 1 /* MS5611 Pressure sensor example
altb2 0:7c23db660183 2 Aerodyne Labs
altb2 0:7c23db660183 3 2014
altb2 0:7c23db660183 4
altb2 0:7c23db660183 5 This example uses the MS511 Library to read the temperature and pressure readings
altb2 0:7c23db660183 6 from the MS5611 sensor. It has been modified from the MS507 sensor library with
altb2 0:7c23db660183 7 the different calculations that the MS5611 requires. Otherwise, this library is
altb2 0:7c23db660183 8 identical to the MS5607
altb2 0:7c23db660183 9 */
altb2 0:7c23db660183 10 #include "mbed.h"
altb2 0:7c23db660183 11
altb2 0:7c23db660183 12 //Only uncomment the one needed.
altb2 0:7c23db660183 13 //#include "MS5611SPI.h"
altb2 0:7c23db660183 14 #include "MS5611I2C.h"
altb2 0:7c23db660183 15
altb2 0:7c23db660183 16 Serial pc(USBTX, USBRX); // local terminal interface
altb2 0:7c23db660183 17
altb2 0:7c23db660183 18 int main() {
altb2 0:7c23db660183 19 pc.baud(115200); // set up USB serial speed
altb2 0:7c23db660183 20 //Only uncomment the I2C or SPI version.
altb2 0:7c23db660183 21 //MS5611SPI ms5611(p11, p12, p13, p10);
altb2 0:7c23db660183 22 //MS5611I2C ms5611(p9, p10, false);
altb2 0:7c23db660183 23 //PB_9 and PB_8 for Nucleo boards
altb2 0:7c23db660183 24 I2C i2c(PB_3,PB_10);
altb2 0:7c23db660183 25 MS5611I2C ms5611(i2c, false);
altb2 0:7c23db660183 26 //Print the Coefficients from the
altb2 0:7c23db660183 27 ms5611.printCoefficients();
altb2 0:7c23db660183 28 while(1){
altb2 0:7c23db660183 29 printf("Pressure = %.0f Pa \r\n", ms5611.getPressure());
altb2 0:7c23db660183 30 printf("Temperature = %.2f degC \r\n", ms5611.getTemperature());
altb2 0:7c23db660183 31 printf("Altitude = %.2f m \r\n", ms5611.getAltitude());
altb2 0:7c23db660183 32 wait(.5);
altb2 0:7c23db660183 33 }
altb2 0:7c23db660183 34 }