Added various bits, main reformatted. Added .get to class Servo to allow waiting for rotation before recording information.

Dependencies:   SLCD mbed

Fork of Lab6_Basic by ECE 111 At Oregon State University

Revision:
8:c2f0e524696b
Parent:
6:a64d79286726
diff -r 10554a04a34f -r c2f0e524696b Motor.h
--- a/Motor.h	Sat Nov 19 09:06:16 2016 +0000
+++ b/Motor.h	Sat Nov 19 09:10:23 2016 +0000
@@ -1,51 +1,63 @@
-#include "Motor.h"
 #include "mbed.h"
-#include "SLCD.h"
-#ifndef MBED_SERVO_H
-#define MBED_SERVO_H
- 
-/** Servo control class, based on a Motor Class object
- *
+#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"
- * #include "Servo.h"
+ *
  * Motor my_motor(P12,P13P,p11);
- * Servo my_servo(p21,my_motor);
- * 
+ *
  * int main() {
- * added .get() to approximate position
+ *   my_motor.Direction(LEFT); will move in the specified direction
  * }
  * @endcode
  */
-class Servo {
+
+ #define LEFT 1
+ #define RIGHT 2
  
+ 
+class Motor
+{
 public:
-    /** Create a servo object.
-     *
-     * @param pin AnalogIn pin to be feedback, motor is a Motor object from Motor.h  
+    /**
+     * 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
      */
-    Servo(PinName analog_input,PinName Positive, PinName Negative,PinName Speed);
-    
-    /** Set the servo position
-     *
-     * @param angle intger in degrees 0-180 to represent the full range.
+    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 set(int degree);
+    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;
+     
     
-    /**  Read the servo current position in degrees from 0-180
-     *
-     * @return returns the current anlge of the servo   
-     */   
-   unsigned int get();    
-     void move(void);
-     
-     void check();
-protected:
-    AnalogIn _feedback;
-    Motor    _motor;
-};
- 
-#endif
- 
\ No newline at end of file
+}; //end of Motor class
+#endif
\ No newline at end of file