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:
- 13:197c4f61b3b7
- Parent:
- 12:2f1e8b205d0f
- Child:
- 14:dc84c793b8b5
--- a/main.cpp Tue Dec 08 02:34:01 2020 +0000
+++ b/main.cpp Tue Dec 08 03:06:43 2020 +0000
@@ -32,6 +32,7 @@
FILE *fp;
char fname[100];
float PI = 3.14159265358979323846f;
+float pw;
//float operation parameters
float target_depth=0; //global target depth default 0
@@ -93,8 +94,8 @@
thruster.pulsewidth(1.3/1000.00);
thruster2.pulsewidth(1.3/1000.00);
}
- }
- while(ttt.read()>=180)
+
+ if (ttt.read()>=180)
{
//stop the timer
@@ -123,6 +124,7 @@
myled=!myled;
wait(1);
}
+ }
@@ -175,7 +177,7 @@
void log_data()
{
fp= fopen(fname, "a");
- fprintf(fp, "$IMU,3,15, %f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3.f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f;\r\n",t.read(),p_sensor.depth(),p_sensor.MS5837_Temperature(),thruster.pulsewidth(7),accel[0],accel[1],accel[2],gyro[0],gyro[1],gyro[2],euler[0],euler[1],euler[2],t_sensor.temp(),photo.light());
+ fprintf(fp, "$NMEA,3,15, %f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f, %3.3f;\r\n",t.read(),p_sensor.depth(),p_sensor.MS5837_Temperature(),pw,accel[0],accel[1],accel[2],gyro[0],gyro[1],gyro[2],euler[0],euler[1],euler[2],t_sensor.temp(),photo.light());
fclose(fp);
// log pulse width
@@ -244,7 +246,7 @@
////Thruster on control, pw->pulse width in milli-second//
//// pw range between 1 to 1.5//
//// on_time-> thruster on time.
-void thrust_on(float pw, float on_time) //input is pulse width
+void thrust_on(float on_time) //input is pulse width
{
float pw_max=2.0;
if(pw>pw_max)
