ECE 111 At Oregon State University / Mbed 2 deprecated Lab4_Basic

Dependencies:   mbed

Revision:
1:4040dba1ef4c
Parent:
0:c542014a089d
Child:
2:538f0e257365
--- a/Motor.h	Fri Aug 19 01:51:07 2016 +0000
+++ b/Motor.h	Fri Aug 19 02:10:52 2016 +0000
@@ -2,7 +2,8 @@
  
 #ifndef MBED_MOTOR_H
 #define MBED_MOTOR_H
- 
+#define LEFT 1
+#define RIGHT 2
 /** Motor class, create motor object to control speed and direction.
  *
  * Example:
@@ -12,11 +13,12 @@
  * Motor my_motor(P12,P13P,p11);
  * 
  * int main() {
- *     
+ * my_motor.Direction(LEFT);
+ * wait(0.1);
  * }
  * @endcode
  */
-class Servo {
+class Motor {
  
 public:
     /** Create a motor object.
@@ -28,7 +30,7 @@
      */
     Motor (PinName Positive, PinName Negative,PinName Speed);
     
-    /** Direction of the movement  
+    /** control the direction of the movement  
      *
      * @param move is LEFT or RIGHT defined as 1 and 2 in Motor.h
      *
@@ -40,7 +42,7 @@
      * 
      */
     void Stop();
-    /** Speed of motor
+    /** control the speed of the motor object 
      * 
      * @param motor_speed from 0 to 100. 0 is the slowest and 100 is max speed. 
      * 
@@ -48,8 +50,9 @@
     void Speed(int motor_speed);
     
 protected:
-    AnalogIn _feedback;
-    Motor    _motor;
+     DigitalOut _positive;
+     DigitalOut _negative;
+     PwmOut     _speed;
 };
  
 #endif