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:
- 22:2a49efff8839
- Parent:
- 21:1a9fe2de6e4f
- Child:
- 23:8ec9b28993d8
--- a/main.cpp Tue Dec 07 14:48:44 2021 +0000 +++ b/main.cpp Tue Dec 07 15:00:54 2021 +0000 @@ -173,25 +173,22 @@ ///-----------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(); - float current_pw=percent; - float current_Xaccel=accelData[0]; - float current_Yaccel=accelData[1]; - float current_Zaccel=accelData[2]; - float current_temp=temp.temp(); - float current_light=light.light(); + + //Code from Licht + //Sample code shows how to read temperature and light data: + BLE.printf("Temperature: %f Light: %f\r\n",temp.temp(), light.light()); + + //Sample code shows how to read pressure sensor + BLE.printf("Depth: %f Pressure: %f Temperature: %f\r\n", p_sensor.depth(), p_sensor.MS5837_Pressure(), p_sensor.MS5837_Temperature()); + p_sensor.Barometer_MS5837(); //NOTE: this function prompts the pressure sensor to collect the next data point, so it must be included! - fprintf(fp, "$DATA, %f, %f, %f, %f, %f, %f, %f, %f, %f\r\n", current_time,current_pressure,current_depth,current_Xaccel,current_Yaccel,current_Zaccel,current_temp,current_light,current_pw); + //Sample code indicates how to read accelerometer data: + BLE.printf("Acceleration: %f %f %f\r\n",accelData[0],accelData[1],accelData[2]); + //end of code from Licht - // log system time t.read() - // log imu data, log science data - // log pulse width - // log pressure sensor data. - // science sensor: temp.temp(), light.light() - // IMU sensor + fprintf(fp, "$DATA, %f, %f, %f, %f, %f, %f, %f, %f, %f\r\n", t.read(),p_sensor.MS5837_Pressure(),p_sensor.depth(),accelData[0],accelData[1],accelData[2],temp.temp(),light.light(),percent); }