Added various bits, main reformatted. Added .get to class Servo to allow waiting for rotation before recording information.
Fork of Lab6_Basic by
Motor.h
- Committer:
- Dogcatfee
- Date:
- 2016-11-19
- Revision:
- 8:c2f0e524696b
- Parent:
- 6:a64d79286726
File content as of revision 8:c2f0e524696b:
#include "mbed.h" #ifndef MOTOR_H #define MOTOR_H /** Motor class * \author Ziad Eldebri * \date Aug 15, 2016 * \bug No bugs yet * Example: * @code * #include "mbed.h" * #include "Motor.h" * * Motor my_motor(P12,P13P,p11); * * int main() { * my_motor.Direction(LEFT); will move in the specified direction * } * @endcode */ #define LEFT 1 #define RIGHT 2 class Motor { public: /** * Motor Will Create a Motor object Connected to the Specified pins. * @param Pins to be Connected to the specified L293 http://www.ti.com/lit/ds/symlink/l293.pdf * @param Positive * @param Negative * @param Speed */ Motor (PinName Positive, PinName Negative,PinName Speed); /** * Control the Direction of the Movement * @param move will specefiy the Direction. * Input 1 or 2. * 1 : Postive VCC Negtaive GND, 2 : Postive GND Negtaive VCC */ void Direction(int move); /** * Stops the Movement of the motor * @param None. * Input 1 or 2. */ void Stop(); /** * Controls the speed of the motor with a input. * @param motor_speed from 0 to 100. 0 is the slowest and 100 is max speed. * */ void Speed(int motor_speed); protected: DigitalOut _positive; DigitalOut _negative; PwmOut _speed; }; //end of Motor class #endif