Sample program for MS5611 (I2C, SPI) library

Dependencies:   MS5611 mbed

Fork of MS5607Example by Hiroshi Yamaguchi

Committer:
matgyver
Date:
Tue Jun 24 05:46:09 2014 +0000
Revision:
1:515d101b8e55
Parent:
0:c06e6d1972d6
Initial commit with new MS5611 library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
matgyver 1:515d101b8e55 1 /* MS5611 Pressure sensor example
matgyver 1:515d101b8e55 2 Aerodyne Labs
matgyver 1:515d101b8e55 3 2014
matgyver 1:515d101b8e55 4
matgyver 1:515d101b8e55 5 This example uses the MS511 Library to read the temperature and pressure readings
matgyver 1:515d101b8e55 6 from the MS5611 sensor. It has been modified from the MS507 sensor library with
matgyver 1:515d101b8e55 7 the different calculations that the MS5611 requires. Otherwise, this library is
matgyver 1:515d101b8e55 8 identical to the MS5607
matgyver 1:515d101b8e55 9 */
yamaguch 0:c06e6d1972d6 10 #include "mbed.h"
matgyver 1:515d101b8e55 11
matgyver 1:515d101b8e55 12 //Only uncomment the one needed.
matgyver 1:515d101b8e55 13 //#include "MS5611SPI.h"
matgyver 1:515d101b8e55 14 #include "MS5611I2C.h"
yamaguch 0:c06e6d1972d6 15
yamaguch 0:c06e6d1972d6 16 int main() {
matgyver 1:515d101b8e55 17 //Only uncomment the I2C or SPI version.
matgyver 1:515d101b8e55 18 //MS5611SPI ms5611(p11, p12, p13, p10);
matgyver 1:515d101b8e55 19 //MS5611I2C ms5611(p9, p10, false);
matgyver 1:515d101b8e55 20 //PB_9 and PB_8 for Nucleo boards
matgyver 1:515d101b8e55 21 MS5611I2C ms5611(PB_9, PB_8, false);
matgyver 1:515d101b8e55 22 //Print the Coefficients from the
matgyver 1:515d101b8e55 23 ms5611.printCoefficients();
matgyver 1:515d101b8e55 24 printf("Pressure = %.0f Pa \r\n", ms5611.getPressure());
matgyver 1:515d101b8e55 25 printf("Temperature = %.2f degC \r\n", ms5611.getTemperature());
matgyver 1:515d101b8e55 26 printf("Altitude = %.2f m \r\n", ms5611.getAltitude());
yamaguch 0:c06e6d1972d6 27 }