testing ms5637 library

Dependencies:   MS5637 mbed

Files at this revision

API Documentation at this revision

Comitter:
cstevens
Date:
Tue May 20 16:19:08 2014 +0000
Commit message:
test for ms5637 barometer with dodgy calibration

Changed in this revision

MS5637.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MS5637.lib	Tue May 20 16:19:08 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/cstevens/code/MS5637/#3a9d37268ccd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 20 16:19:08 2014 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "ms5637.h"
+
+ms5637 ms(PTE0, PTE1);                        // i2c pins used
+Serial pc(USBTX, USBRX);                   // local terminal interface
+
+
+int main (void)
+{
+    pc.baud(9600);                        // set up USB serial speed
+
+    // set up the ms5611
+    pc.printf("\n\nInitializing the MS5611..\n\r");
+    ms.cmd_reset();
+    pc.printf("Ready new\n\r");
+
+    while(1) {
+        double Temp = ms.calcTemp();                         //calculate press and temp, then returns current temperature in degC
+        double Press = ms.calcPressure();                    //calculate press and temp, then returns current pressure in mb
+        double GetPress = ms.getPressure();                  //returns current pressure in mb. Does no calculations.  Ususally done after calcTemp()
+        double Altitude = ms.getAltitudeFT(1013.25);         //enter pressure at sea level in mb, returns altitude in feet
+        double PressSeaLvlFT = ms.getSeaLevelBaroFT(327.2);  //enter known altitude in feet, returns sea level pressure in mb
+        double PressSeaLvlM = ms.getAltitudeFT(99.73);       //enter known altitude in meters, returns seal level pressure in mb
+
+        pc.printf("Temp: %.2f degC - ", Temp);
+        pc.printf("Barometer: %.1f mB  %.3f in/Hg - \r", Press, Press * 0.0295301);
+    //    pc.printf("Alt: %.1f ft - ", Altitude);
+     //   pc.printf("Sea_Lvl: %.1f ft   %.2f m\r", PressSeaLvlFT, PressSeaLvlM);
+        wait(2.0);
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 20 16:19:08 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file