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:
- 7:b3cc3dd22f55
- Parent:
- 6:f8535633c551
- Child:
- 8:7f970fcf1a16
diff -r f8535633c551 -r b3cc3dd22f55 main.cpp
--- a/main.cpp Thu Dec 03 14:41:25 2020 +0000
+++ b/main.cpp Thu Dec 03 14:50:58 2020 +0000
@@ -77,7 +77,16 @@
while(1)
{
p_sensor.Barometer_MS5837();
-
+ //Depth Holding
+ 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);
+ }
+ /*
printf("Pressure: ");
printf("%f",p_sensor.MS5837_Pressure());
printf(" mbar");
@@ -93,7 +102,7 @@
printf("Altitude: ");
printf("%f",p_sensor.altitude());
printf(" m above mean sea level\r\n");
-
+*/
myled=!myled;
wait(1);
}
@@ -235,15 +244,6 @@
thruster.period(20.0/1000.00); // 20 ms period
thruster.pulsewidth(pw/1000.00);
thruster2.pulsewidth(pw/1000.00);
- //Depth Holding
- 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(200.0/1000.00);
- thruster2.pulsewidth(200.0/1000.00);
- }
//PWM will be kept until time out
while(tt.read()<=on_time)
{
