Sample program for MS5611 (I2C, SPI) library
Fork of MS5607Example by
main.cpp
00001 /* MS5611 Pressure sensor example 00002 Aerodyne Labs 00003 2014 00004 00005 This example uses the MS511 Library to read the temperature and pressure readings 00006 from the MS5611 sensor. It has been modified from the MS507 sensor library with 00007 the different calculations that the MS5611 requires. Otherwise, this library is 00008 identical to the MS5607 00009 */ 00010 #include "mbed.h" 00011 00012 //Only uncomment the one needed. 00013 //#include "MS5611SPI.h" 00014 #include "MS5611I2C.h" 00015 00016 int main() { 00017 //Only uncomment the I2C or SPI version. 00018 //MS5611SPI ms5611(p11, p12, p13, p10); 00019 //MS5611I2C ms5611(p9, p10, false); 00020 //PB_9 and PB_8 for Nucleo boards 00021 MS5611I2C ms5611(PB_9, PB_8, false); 00022 //Print the Coefficients from the 00023 ms5611.printCoefficients(); 00024 printf("Pressure = %.0f Pa \r\n", ms5611.getPressure()); 00025 printf("Temperature = %.2f degC \r\n", ms5611.getTemperature()); 00026 printf("Altitude = %.2f m \r\n", ms5611.getAltitude()); 00027 }
Generated on Fri Jul 15 2022 22:07:01 by 1.7.2