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.
Revision 5:e0c525588568, committed 2021-04-09
- Comitter:
- pmmccorkell
- Date:
- Fri Apr 09 12:16:30 2021 +0000
- Parent:
- 4:d32183587460
- Commit message:
- adsf
Changed in this revision
thruster.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/thruster.cpp Fri Apr 09 11:38:56 2021 +0000 +++ b/thruster.cpp Fri Apr 09 12:16:30 2021 +0000 @@ -17,11 +17,11 @@ Thruster::Thruster(PinName pin, float dir) : _pwm(pin), _d(dir) { _lock=0; // emergency lockout, default is 0 _pin=pin; // PWM pin + _period=20.0; // 2.5ms + set_period(_period); // set period to 2.5ms (400Hz) + _max=500; // max PWM value in us _base_pw=1.5; // 1.5ms set_pw(_base_pw); // set PWM to 1.5ms - _period=2.5; // 2.5ms - set_period(_period); // set period to 2.5ms (400Hz) - _max=150; // max PWM value in us //printf("Thruster: %f\r\n",d); } @@ -103,7 +103,7 @@ } else { double tolerance_pw=0.001; - double target_pw=(_d*speed_pw)+_base_pw; + double target_pw=(_d*speed_pw)/1000+_base_pw; double current_pw=get_pw(); double diff_pw=abs(target_pw-current_pw); if (diff_pw>tolerance_pw) {