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.
Dependencies: mbed MMA8452Q MS5837 SDFileSystem SCI_SENSOR
Diff: main.cpp
- Revision:
- 19:c78d3e8353c4
- Parent:
- 18:b5f58a274570
- Child:
- 20:6fb55c833f9f
--- a/main.cpp Fri Dec 03 20:21:19 2021 +0000 +++ b/main.cpp Tue Dec 07 14:22:05 2021 +0000 @@ -28,6 +28,7 @@ // global timer Timer t; +Timer t2; //part two timer ///File FILE *fp; @@ -90,7 +91,7 @@ wait(1); //Part One - /*int count=0; + int count=0; while(1) { count=count+1; @@ -101,10 +102,12 @@ if count==3{ return 0; } - }*/ + } //Part Two + t2.start(); while(1) { + float current_depth=p_sensor.depth(); float pw=percent; float on_time=3; @@ -112,12 +115,12 @@ if (current_depth-vessel_length<2) { thrust_on(pw,on_time); } - if t.read()>60{ //60 because counting in seconds? + if t2.read()>60{ //60 because counting in seconds? return 0; } } - //Part Three + /*Part Three while(1) { error_deep = 2.5; //deep end of error band 2.5m ? error_shallow = 1.5; //shallow end of error band 1.5m? @@ -130,7 +133,7 @@ pw = ; //very low thruster percentage thrust_on(pw,on_time); //run thruster at very low percentage to maintain depth } - // + */ //-------------Customized functions---------------------------------------------//---------------------------------------- ///-----------Welcome menu---------------------/// @@ -172,6 +175,7 @@ ///-----------log functions---------------------/// void log_data() { + p_sensor.Barometer_MS5837(); float current_time=t.read(); float current_pressure=p_sensor.MS5837_Pressure(); float current_depth=p_sensor.depth();