LPS22HBのライブラリ
Dependents: HYBRYD2018_IZU_ROCKET Hybrid_IZU201811_STMBBM_v4 Hybrid_IZU2019
Diff: pqLPS22HB_lib.cpp
- Revision:
- 4:b5c758ebd064
- Parent:
- 2:96d154c590f4
--- 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