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
Revision 1:98a8282033ab, committed 2019-01-27
- Comitter:
- alienbernamaihsan
- Date:
- Sun Jan 27 10:56:40 2019 +0000
- Parent:
- 0:de471bead4f2
- Commit message:
- Driver motor Dagozilla V.2 (NOT gate);
Changed in this revision
| motor.cpp | Show annotated file Show diff for this revision Revisions of this file |
| motor.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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
+}
--- a/motor.h Wed Oct 03 11:01:42 2018 +0000
+++ b/motor.h Sun Jan 27 10:56:40 2019 +0000
@@ -6,12 +6,11 @@
class motor
{
public :
- motor(PinName dright , PinName dleft, PinName pwmpin);
+ motor(PinName direction, PinName pwmpin);
void setpwm(float inputpwm);
private :
PwmOut _pwmpin;
- DigitalOut _dright;
- DigitalOut _dleft;
+ DigitalOut _direction;
};
#endif