cleaned up motor class with separate header and .cpp files

Dependencies:   mbed

Dependents:   TerraBot_Drive_2D TerraBot_Drive_2D TerraBot_Drive_2D_FINAL DUMP_TRUCK_Test ... more

Revision:
0:0a5af2965205
Child:
1:92be353590b4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.cpp	Fri Oct 07 01:21:10 2016 +0000
@@ -0,0 +1,22 @@
+#include "Motor.h"
+
+Motor::Motor(PinName pwm, PinName dir) : pwmPin(pwm), dirPin(dir)
+    {
+    }
+
+void Motor::write(float Val)
+   {
+      if (Val >= 0) {
+        dirPin = 1;
+        pwmPin = Val;
+        }else {
+            dirPin = 0;
+            pwmPin = -1 * Val;
+    }
+    lastVal = Val;
+ }
+   
+float Motor::read()
+   {
+        return lastVal;
+   }
\ No newline at end of file