風速計用プログラムです。動きません……

Dependencies:   mbed

Fork of mbed_fuusoku by natsu tsumagari

やっぱり動きます(InterruptInをp30に設定すると読まなくなるボードがあります……)。最新のは校正済みです。

Revision:
1:d802daeec8f6
Parent:
0:51b2d6484a7d
Child:
2:ba1abf27fe4c
--- a/Fusokukei.h	Sat Nov 19 03:49:07 2016 +0000
+++ b/Fusokukei.h	Sat Nov 19 06:37:33 2016 +0000
@@ -3,8 +3,7 @@
 
 #include "mbed.h"
 
-
-#define AIR_K 0.14737
+#define AIR_K 4.89799 //0.14737
 #define AIR_N 1.12
 #define AIR_A 1.4314
 #define AIR_B 0.209
@@ -17,6 +16,8 @@
 int air_counter = 0;
 float air_sum[AIR_SUM_NUM] = {0.0};
 
+double air_r=0;
+
 class Fusokukei{
     protected:
     
@@ -33,8 +34,9 @@
         return 0;
     }
     
-    void calcAirSpeed(float x){
-          air_sum[air_counter % AIR_SUM_NUM] = (float)AIR_K * (float)pow((double)x, 1 / AIR_N);
+    void calcAirSpeed(double x){
+          air_r = x/150.0;
+          air_sum[air_counter % AIR_SUM_NUM] = (float)AIR_K * (float)pow((double)air_r, 1 / AIR_N);
           if(air_counter % AIR_SUM_NUM == 0)
             air_counter = 0;
           airSpeed_ave = make_ave(air_sum, AIR_SUM_NUM);