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:
- 29:48534309e09d
- Parent:
- 28:55b04fb61809
- Child:
- 30:c54217fc9314
--- a/main.cpp Wed Dec 08 19:39:15 2021 +0000 +++ b/main.cpp Wed Dec 08 20:31:29 2021 +0000 @@ -69,6 +69,9 @@ //inital set the thruster esc to 1ms duty cycle thruster.period(0.002); // 2 ms period thruster.pulsewidth(1.0/1000.000); + + thruster2.period(0.002); // 2 ms period + thruster2.pulsewidth(1.0/1000.000); //Initialize accelerometer: accel.init(); @@ -88,8 +91,7 @@ //so we could have all our control code in the while loop // //log at 2 Hz accel_ticker.attach(&accel_update,0.1); //10Hz - log_ticker.attach(&log_data,0.5); - wait(1); + //log_ticker.attach(&log_data,0.5); led1=0; led2=0; @@ -97,10 +99,10 @@ int count=0; while(count<3) { led3=1; - count=count+1; float pw= percent; float on_time =tim; thrust_on(pw, on_time); //turn thruster on for 5 seconds + count=count+1; wait(1); } @@ -193,7 +195,7 @@ //end of code from Licht fp = fopen(fname, "a"); - 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); + fprintf(fp, "$DATA, Time:%f, Pressure:%f, Depth:%f, Acceleration:%f, %f, %f, Temp:%f, Light:%f, Percent:%f\r\n", t.read(),p_sensor.MS5837_Pressure(),p_sensor.depth(),accelData[0],accelData[1],accelData[2],temp.temp(),light.light(),percent); fclose(fp); } @@ -224,7 +226,7 @@ //PWM will be kept until time out while(tt.read()<=on_time) { - pc.printf("thruster on?...mack is cool\r\n"); //print check + BLE.printf("thruster on?...mack is cool\r\n"); //print check } //stop the timer tt.stop(); @@ -233,6 +235,3 @@ thruster2.pulsewidth(1.0/1000.00); } - -///void thrust_off(float pw, float on_time) //input is pulse width -// \ No newline at end of file