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.
Dependents: Coba_Motor_Driver_V2
Diff: motor.cpp
- Revision:
- 1:98a8282033ab
- Parent:
- 0:de471bead4f2
--- a/motor.cpp Wed Oct 03 11:01:42 2018 +0000
+++ b/motor.cpp Sun Jan 27 10:56:40 2019 +0000
@@ -2,7 +2,7 @@
-motor :: motor ( PinName dright , PinName dleft, PinName pwmpin) : _dright(dright) , _dleft(dleft), _pwmpin(pwmpin)
+motor :: motor ( PinName direction, PinName pwmpin) : _direction(direction), _pwmpin(pwmpin)
{
_pwmpin.period_us(50);
}
@@ -11,14 +11,12 @@
{
if ( inputpwm >= 0 )
{
- _dright = 1;
- _dleft = 0;
+ _direction = 1;
_pwmpin.write(inputpwm);
}
else
{
- _dright = 0;
- _dleft = 1;
+ _direction = 0;
_pwmpin.write(-1*inputpwm);
}
-}
\ No newline at end of file
+}