2017年度の製作を開始します。

Dependencies:   BufferedSoftSerial2 SDFileSystem-RTOS mbed mbed-rtos INA226_ver1

Fork of keiki2016ver5 by albatross

Branch:
Thread-gyogetsuMPU
Revision:
51:f391d3a02397
Parent:
27:d2955f29a3aa
Child:
52:a94cbaef3602
Child:
57:d415d463a605
--- a/Fusokukei.h	Fri Apr 21 05:44:00 2017 +0000
+++ b/Fusokukei.h	Fri Apr 21 10:50:05 2017 +0000
@@ -4,7 +4,7 @@
 #include "mbed.h"
 
 
-#define AIR_K 4.70591884 //0.14737
+#define AIR_K 0.14737
 #define AIR_N 1.12
 #define AIR_A 1.4314
 #define AIR_B 0.209
@@ -34,7 +34,7 @@
     }
     
     void calcAirSpeed(float x){
-          air_sum[air_counter % AIR_SUM_NUM] = (float)AIR_K * (float)pow((double)(x/150.0), 1 / AIR_N);
+          air_sum[air_counter % AIR_SUM_NUM] = (float)AIR_K * (float)pow((double)x, 1 / AIR_N);
           if(air_counter % AIR_SUM_NUM == 0)
             air_counter = 0;
           airSpeed_ave = make_ave(air_sum, AIR_SUM_NUM);
@@ -45,4 +45,55 @@
           air_counter++;
       }
 };
-#endif
\ No newline at end of file
+#endif
+//#ifndef FUSOKUKEI_H
+//#define FUSOKUKEI_H
+//
+//#include "mbed.h"
+//
+//
+//#define AIR_K 4.70591884 //0.14737
+//#define AIR_N 1.12
+//#define AIR_A 1.4314
+//#define AIR_B 0.209
+//#define AIR_SUM_NUM 3
+//#define AIR_BUFFER 30
+//
+//float airSpeed = 0.0;
+//float airSpeed_ave = 0.0;
+//float airSpeed_max = 0.0;
+//int air_counter = 0;
+//float air_sum[AIR_SUM_NUM] = {0.0};
+//
+//class Fusokukei{
+//    protected:
+//    
+//    public:      
+//    float make_ave(float s[], int n){
+//        float p = 0;
+//        int i;
+//        for(i = 0; i < n; i++){
+//           p += s[i];    
+//        }
+//        if(n != 0)
+//        return p / n;    
+//        else
+//        return 0;
+//    }
+//    
+//    void calcAirSpeed(int x){
+//          air_sum[air_counter % AIR_SUM_NUM] = (float)AIR_K * (float)pow((double)(x/150.0), 1 / AIR_N);
+//          
+//          airSpeed_ave = make_ave(air_sum, AIR_SUM_NUM);
+//          
+//          //airSpeed = airSpeed_ave*AIR_A+AIR_B;
+//          airSpeed=airSpeed_ave;
+//          if(airSpeed > airSpeed_max)
+//            airSpeed_max = airSpeed;
+//          if(air_counter % AIR_SUM_NUM == 0){
+//            air_counter = 0;
+//          }
+//          air_counter++;
+//      }
+//};
+//#endif
\ No newline at end of file