Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 10:02584efdaa39
- Parent:
- 9:120ab4a494ec
- Child:
- 11:b62f06b3e398
--- a/main.cpp Thu Dec 03 15:31:25 2020 +0000 +++ b/main.cpp Thu Dec 03 15:37:40 2020 +0000 @@ -81,26 +81,28 @@ ttt.start(); p_sensor.Barometer_MS5837(); //Depth Holding - if (p_sensor.depth()>2.0) { - thruster.pulsewidth(1.0/1000.00); - thruster2.pulsewidth(1.0/1000.00); + if (p_sensor.depth()>2.0) { + thruster.pulsewidth(1.0/1000.00); + thruster2.pulsewidth(1.0/1000.00); } else if(p_sensor.depth()<2.0) { thruster.pulsewidth(1.6/1000.00); thruster2.pulsewidth(1.6/1000.00); - } - else if(p_sensor.depth()==2.0) { + } + else if(p_sensor.depth()==2.0) { thruster.pulsewidth(1.3/1000.00); thruster2.pulsewidth(1.3/1000.00); - } - while(ttt.read()>=180) - { + } } + 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()); @@ -122,7 +124,7 @@ wait(1); } - } + //-------------Customized functions---------------------------------------------//---------------------------------------- ///-----------Welcome menu---------------------///