統合プログラム

Dependencies:   mbed Servo BMP180

Revision:
3:a583276d9fef
Parent:
1:bb89b58cfa0e
Child:
4:6e24a1b3edca
--- a/Landing_Judgement.h	Wed Oct 27 20:59:02 2021 +0000
+++ b/Landing_Judgement.h	Thu Oct 28 07:57:02 2021 +0000
@@ -1,12 +1,16 @@
 #include "mbed.h"
 #include "BMP180.h"
 #include "calculate.h"
+#define PIN_SDA D4
+#define PIN_SCL D5
+
+BMP180 bmp180(PIN_SDA,PIN_SCL);
 
 class Landing_Judgement:public BMP180{
     private:
         
     int x ,y ,n1 , n2 ;
-    int landing ;
+    int landing_judgement ;
     float h,dp,dt,dp0;
     float a ,b ,dp_ave,dt_ave;
     //hは高度、dpは気圧、dtは温度、dp0は海面気圧
@@ -24,9 +28,18 @@
 };
 
 int Landing_Judgement::landing_judgement(){
-     bmp180.Initialize(27,int BMP180_OSS_ULTRA_LOW_POWER);//27は府大の海抜高度
+     
+    landing_judgement = 0;
+    x = 0;
+    y = 0;
+    n1 = 0;
+    n2 = 0;
+    a = 0;
+    b = 0;
+     
+    bmp180.Initialize(27,int BMP180_OSS_ULTRA_LOW_POWER);//27は府大の海抜高度
     
-    for(i=0;i<15;i++){
+    for(int i=0;i<15;i++){
         if(bmp180.ReadData(&dt,&dp)){
             a = a + dp;
             b = b + dt;