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 MS5837 LSM9DS1 GPSINT_LMC SCI_SENSOR
Revision 4:dfdb68d3c7d0, committed 2020-12-07
- Comitter:
- mikekelly99
- Date:
- Mon Dec 07 16:28:07 2020 +0000
- Parent:
- 3:f3a9513703fc
- Commit message:
- Seems to be okay, made adjustments given from Mingxi
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Dec 06 16:17:35 2020 +0000
+++ b/main.cpp Mon Dec 07 16:28:07 2020 +0000
@@ -76,40 +76,23 @@
thruster.pulsewidth(pw/1000.000);
thruster2.pulsewidth(pw/1000.000);
wait(5);
- pw=pw+0.1; //increase the speed
-
- if(pw>1.4) { //max-out at 1.4 otherwise it is too fast
+
+ if(pw>1.4); { //max-out at 1.4 otherwise it is too fast
pw=1.4;
}
- {
+
p_sensor.Barometer_MS5837();
- printf("Pressure: ");
- printf("%f",p_sensor.MS5837_Pressure());
- printf(" mbar");
-
- printf("Temperature: ");
- printf("%f",p_sensor.MS5837_Temperature());
- printf(" deg C ");
-
- printf("Depth: ");
- printf("%f",p_sensor.depth());
- printf(" m ");
-
- printf("Altitude: ");
- printf("%f",p_sensor.altitude());
- printf(" m above mean sea level\r\n");
-
myled=!myled;
- wait(1);
- }
+ wait(0.1);
+
if (p_sensor.depth() < 2.00){
pw=1.4;
- printf("descending")
+ printf("descending");
}
if (p_sensor.depth() >= 2.00){
pw=1;
- printf("2 meter depth reached")
+ printf("2 meter depth reached");
}
}
}
@@ -160,13 +143,20 @@
///-----------log functions---------------------///
void log_data()
{
- //log system time t.read()
- // log imu data, log sciene data
- // log pulse width
- // log pressure sensor data.
- //science sensor: temp.temp(), light.light()
- //IMU sensor
-
+ t.read();
+ IMU.calcGyro(IMU.gx);
+ IMU.calcGyro(IMU.gy);
+ IMU.calcGyro(IMU.gz);
+ IMU.calcAccel(IMU.ax);
+ IMU.calcAccel(IMU.ay);
+ IMU.calcAccel(IMU.az);
+ p_sensor.depth();
+ p_sensor.Barometer_MS5837();
+ temp.temp();
+ light.light();
+ thruster.pulsewidth(pw/1000);
+ thruster2.pulsewidth(pw/1000);
+
}
///-----------IMU related functions---------------------///