Create a motor object, to control a motor using L293DNE and FDRM-KL46z.
Dependencies: mbed
Diff: Motor.cpp
- Revision:
- 2:538f0e257365
- Parent:
- 1:4040dba1ef4c
- Child:
- 3:41acca236570
--- a/Motor.cpp Fri Aug 19 02:10:52 2016 +0000 +++ b/Motor.cpp Fri Oct 21 16:39:10 2016 +0000 @@ -1,10 +1,12 @@ #include "mbed.h" #include "Motor.h" -Motor::Motor(PinName Positive, PinName Negative,PinName Speed): - _positive(Positive), _negative(Negative), _speed(Speed) { - _speed.period(0.03f); // 4 second period - _speed.write(0.20f); +Motor::Motor(PinName Positive, PinName Negative): _positive(Positive), _negative(Negative){ + _positive.period(0.03f); // 4 second period + _positive.write(0.25f); + _negative.period(0.03f); // 4 second period + _negative.write(0.25f); + } /* Input 1 or 2 or LEFT and RIGHT * 1 : Postive VCC Negtaive GND, 2 : Postive GND Negtaive VCC. @@ -30,5 +32,5 @@ void Motor::Speed(int motor_speed) { float percantage = motor_speed/100; - _speed.write(percantage); + }//End of Speed \ No newline at end of file