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:
- 9:e4e1d5db0c04
- Parent:
- 8:cca95817a93b
- Child:
- 10:b2fe6d1dee81
--- a/main.cpp Tue Nov 30 15:34:44 2021 +0000 +++ b/main.cpp Tue Nov 30 16:01:16 2021 +0000 @@ -48,12 +48,14 @@ //IMU related void accel_update(); //update accelerometer related variables. we use imu_ticker to call this function +//Control Parameters +float tim =5; //define thruster on time +float percent = 1.2; //user defined percent of thrust power + //Control related functions void thrust_on(float pw, float on_time); //input is pulse width -//Control Parameters -float on_time = 5; //on for 5 seconds part one -float pw=1000; //pw? //define this? + //-------------Main functions----------------------------------------------------------------------------------------- int main() @@ -83,9 +85,10 @@ accel_ticker.attach(&accel_update,0.1); //10Hz log_ticker.attach(&log_data,0.5); wait(1); + while(1) { - thrust_on(); //turn thruster on for 5 seconds + thrust_on(float pw, float on_time); //turn thruster on for 5 seconds // put your main control code here } @@ -161,6 +164,8 @@ //// on_time-> thruster on time. void thrust_on(float pw, float on_time) //input is pulse width { + float pw= percent; + float on_time =tim; float pw_max=2.0; if(pw>pw_max) {