Mark Schwarzer / Mbed 2 deprecated Project_OCE360

Dependencies:   mbed

Revision:
9:120ab4a494ec
Parent:
8:7f970fcf1a16
Child:
10:02584efdaa39
--- a/main.cpp	Thu Dec 03 15:01:27 2020 +0000
+++ b/main.cpp	Thu Dec 03 15:31:25 2020 +0000
@@ -26,6 +26,8 @@
 // global timer
 Timer t;
 //MS5837 p_sensor(p9, p10, ms5837_addr_no_CS);
+Timer ttt;
+//timer for running thrusters
 ///File 
 FILE *fp;
 char fname[100];
@@ -76,6 +78,7 @@
     wait(1);
     while(1)
     { 
+        ttt.start();
         p_sensor.Barometer_MS5837();
         //Depth Holding
     if (p_sensor.depth()>2.0) {
@@ -90,6 +93,14 @@
             thruster.pulsewidth(1.3/1000.00);
             thruster2.pulsewidth(1.3/1000.00);
                 }
+        while(ttt.read()>=180)
+        {   
+    }
+            //stop the timer
+            ttt.stop();
+            //turn off the thruster
+            thruster.pulsewidth(1.0/1000.00);
+            thruster2.pulsewidth(1.0/1000.00);
  /*
         printf("Pressure: "); 
         printf("%f",p_sensor.MS5837_Pressure());