LPS22HBのライブラリ

Dependents:   HYBRYD2018_IZU_ROCKET Hybrid_IZU201811_STMBBM_v4 Hybrid_IZU2019

Files at this revision

API Documentation at this revision

Comitter:
Sigma884
Date:
Wed Feb 20 12:26:08 2019 +0000
Parent:
2:96d154c590f4
Commit message:
getAlt2 comming!!

Changed in this revision

pqLPS22HB_lib.cpp Show annotated file Show diff for this revision Revisions of this file
pqLPS22HB_lib.h Show annotated file Show diff for this revision Revisions of this file
--- a/pqLPS22HB_lib.cpp	Wed Nov 14 09:15:47 2018 +0000
+++ b/pqLPS22HB_lib.cpp	Wed Feb 20 12:26:08 2019 +0000
@@ -131,3 +131,15 @@
     
     return -(273.0 + temp_0) / 0.0342 * log(pres_now / pres_0);
 }
+
+/**********
+高度を取得(float)
+※温度の高度による変化を考慮
+※こちらを推奨
+・引数に0m地点での気圧・温度を入れる
+・計算式のソース:http://zakii.la.coocan.jp/physics/31_pressure.htm
+**********/
+float pqLPS22HB_lib :: getAlt2(float P_0, float T_0){
+    pres = getPres();
+    return (273.0 + T_0) / 0.0065 * (1.0 - (float)pow((double)(pres / P_0), 0.190));
+}
\ No newline at end of file
--- a/pqLPS22HB_lib.h	Wed Nov 14 09:15:47 2018 +0000
+++ b/pqLPS22HB_lib.h	Wed Feb 20 12:26:08 2019 +0000
@@ -97,6 +97,18 @@
     float pres_0;
     float temp_0;
     float pres_now;
+    
+/**********
+高度を取得(float)
+※温度の高度による変化を考慮
+※こちらを推奨
+・引数に0m地点での気圧・温度を入れる
+・計算式のソース:http://zakii.la.coocan.jp/physics/31_pressure.htm
+**********/
+    public:
+    float getAlt2(float P_0, float T_0);
+    private:
+    float pres;
 };
 
 #endif