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.
Diff: Motor.cpp
- Revision:
- 3:00a812f5ac69
- Parent:
- 2:55726bc51f31
- Child:
- 4:ec8d27a44a4f
--- a/Motor.cpp Fri Aug 30 03:06:27 2019 +0000
+++ b/Motor.cpp Sun Sep 15 17:40:14 2019 +0000
@@ -3,7 +3,7 @@
Motor::Motor(PinName _pwm, PinName _dire, int freq) : pwm(_pwm), dire(_dire)
{
- abs_max_output = 1.0;
+ abs_max_output = 0.95;
pwm.period(1.0 / freq);
pwm.write(0);
dire = 0;
@@ -21,12 +21,12 @@
pwm = 0;
dire = 0;
}
- else if (output > abs_max_output * 0.05)
+ else if (output > 0.01)
{
pwm = output * abs_max_output;
dire = 0;
}
- else if (output < -abs_max_output * 0.05)
+ else if (output < -0.01)
{
pwm = -output * abs_max_output;
dire = 1;