megan gimple / Mbed 2 deprecated OCE360_Final_Project

Dependencies:   mbed MMA8452Q MS5837 SDFileSystem SCI_SENSOR

Revision:
17:e72c4ac9a39e
Parent:
16:6cc2ad084c2d
Child:
18:b5f58a274570
--- a/main.cpp	Thu Dec 02 14:50:15 2021 +0000
+++ b/main.cpp	Thu Dec 02 15:12:59 2021 +0000
@@ -39,6 +39,7 @@
 int yo_num=0;               //global yo_num default 0
 float thrust_on_time=0;     //global thrust_on time default 0
 float accelData[3];         //global accel data
+float vessel_lenth=1;
 
 //functions
 void welcome();
@@ -88,7 +89,8 @@
     log_ticker.attach(&log_data,0.5);
     wait(1);
     
-    int count=0;
+    //Part One
+    /*int count=0;
     while(1)
     {
       count=count+1;
@@ -99,7 +101,24 @@
       if count==3{
         return 0;
         }
-    }
+    }*/
+    
+    //Part Two
+    while(1){
+        float current_depth=p_sensor.depth();
+        float pw=percent;
+        float on_time=3;
+        
+        if (current_depth-vessel_length<2){
+            thrust_on(pw,on_time);
+            }
+        if t.read()>1{
+            return 0;
+            } 
+        }
+    
+    
+    
 
 }