2017.11伊豆大島共同打ち上げ実験の開放用プログラム

Dependencies:   BMP180 MPU6050 mbed

Fork of Sample_BMP180 by CORE

Files at this revision

API Documentation at this revision

Comitter:
mikawataru
Date:
Tue Jun 07 05:17:35 2016 +0000
Child:
1:b9ea35d93329
Commit message:
sample of using BMP180

Changed in this revision

BMP180.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/BMP180.lib	Tue Jun 07 05:17:35 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/spiridion/code/BMP180/#072073c79cfd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 07 05:17:35 2016 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "math.h"
+#include "BMP180.h"
+#define p0 1013.25f//海面気圧
+
+DigitalOut myled(LED1);
+Serial pc(USBTX,USBRX);
+BMP180 bmp(PB_7, PB_6);
+Timer timer;
+
+float getAlt(float press, float temp);
+
+int main() {
+    float pressure,temperature,altitude;
+    float time;   
+    bmp.Initialize(64,BMP180_OSS_ULTRA_LOW_POWER);
+    pc.printf("time, temperature ,pressure, altitude\r\n");
+    timer.start();
+    
+    while(1) {
+        bmp.ReadData(&temperature,&pressure);
+        altitude = getAlt(pressure,temperature);
+        time = timer.read();
+        pc.printf("%f, %f, %f, %f \r\n",time, temperature, pressure, altitude);
+        myled =! myled;
+        wait(1);
+    }
+}
+
+float getAlt(float press, float temp){
+    return (pow((p0/press), (1.0f/5.257f))-1.0f)*(temp+273.15f)/0.0065f;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 07 05:17:35 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file