Fet

Dependencies:   mbed BMP180

Files at this revision

API Documentation at this revision

Comitter:
naruu
Date:
Sat Nov 28 09:48:52 2020 +0000
Parent:
0:c2d05d76f730
Commit message:
FET

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c2d05d76f730 -r d51aa991d297 main.cpp
--- a/main.cpp	Sat Nov 28 08:44:03 2020 +0000
+++ b/main.cpp	Sat Nov 28 09:48:52 2020 +0000
@@ -1,15 +1,18 @@
 #include "mbed.h"
 #include "BMP180.h"
 #include <math.h>
+#include <stdio.h>
 
 #define PIN_SDA D4
 #define PIN_SCL D5
 Serial pc(SERIAL_TX,SERIAL_RX,921600);
 Serial xbee(D1,D0);
+DigitalOut FET(D9);
+
 
 int main(){
     float x8;
-    
+    FET=0;
     BMP180 bmp180(PIN_SDA,PIN_SCL);
     float pressure,temperature,altitude;
     xbee.printf("\rstart!\n\r");
@@ -59,7 +62,7 @@
                 xbee.printf("--------------------------------\n\r");
                 x8 = y8;
                 wait(1);
-                if(altitude==0){
+                if(speed<=0){
                     break;
                     }}
                 else{
@@ -67,6 +70,8 @@
                     wait(1);
                     }
            }         
-    
+    FET=1;
+wait(20);
+FET=0;
 return 0;
 }
\ No newline at end of file