yuu U / Mbed 2 deprecated Bar02_MS5837-02BA

Dependencies:   MS5837 mbed

Files at this revision

API Documentation at this revision

Comitter:
yuuitirou528
Date:
Tue Jul 17 16:12:11 2018 +0000
Child:
1:6e3642607302
Commit message:
releas

Changed in this revision

MS5837.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/MS5837.lib	Tue Jul 17 16:12:11 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aolgu003/code/MS5837/#ee71a13b8e68
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jul 17 16:12:11 2018 +0000
@@ -0,0 +1,51 @@
+//Bar02 Ultra High Resolution 10m Depth/Pressure Sensor sample
+//MS5837-02BA onry
+//ArduinoLibrary->mbedLibrary
+
+//https://os.mbed.com/teams/POTLESS/code/MS5837/
+//https://github.com/bluerobotics/BlueRobotics_MS5837_Library
+
+#include "mbed.h"
+#include "MS5837.h"
+
+
+Serial pc(USBTX, USBRX,115200); // tx, rx
+
+//I2C i2c(I2C_SDA,I2C_SCL);
+MS5837 sensor(I2C_SDA, I2C_SCL, ms5837_addr_no_CS);
+
+
+int main() {
+  // Initialize pressure sensor
+  // Returns true if initialization was successful
+  // We can't continue with the rest of the program unless we can initialize the sensor
+    printf("start"); 
+    sensor.MS5837Reset();
+    sensor.MS5837Init();
+    printf("ok"); 
+
+    
+    while(1) {    
+    
+        sensor.Barometer_MS5837();
+
+        printf("Pressure: "); 
+        printf("%f",sensor.MS5837_Pressure()); 
+        printf(" mbar");
+          
+        printf("Temperature: "); 
+        printf("%f",sensor.MS5837_Temperature()); 
+        printf(" deg C ");
+          
+        printf("Depth: "); 
+        printf("%f",sensor.depth()); 
+        printf(" m ");
+          
+        printf("Altitude: "); 
+        printf("%f",sensor.altitude()); 
+        printf(" m above mean sea level\r\n");
+        
+            
+        wait(1);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jul 17 16:12:11 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file