Soft robot team / Mbed OS Robot_team1

Dependencies:   QEI Motordriver ros_lib_melodic

Revision:
5:8ef79eebbc97
Parent:
0:57855aafa907
Child:
6:858a5116688e
--- a/motor/Motor.cpp	Tue Oct 22 11:52:32 2019 +0000
+++ b/motor/Motor.cpp	Tue Oct 22 15:06:44 2019 +0000
@@ -0,0 +1,47 @@
+#include "Motor.h"
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+Motor::Motor(PinName in1, PinName in2, PinName pwm)
+: in1(in1), in2(in2), pwm(pwm) {}
+
+///////////////////////////////////////////////////////////////////
+// Public methods
+///////////////////////////////////////////////////////////////////
+
+//TODO
+void Motor::moveForward()
+{
+    in1 = 1; 
+    in2 = 0;
+    
+    pwm.period_ms(10);
+    pwm.write(0.5f);
+}
+
+//TODO
+void Motor::moveBack()
+{
+    pwm.period_ms(10);
+    pwm.write(0.5f);
+}
+
+//TODO
+void Motor::turnLeft()
+{
+    in1 = 0;
+    in2 = 1;
+    
+    pwm.period_ms(10);
+    pwm.write(0.5f);
+}
+
+//TODO
+void Motor::turnRight()
+{
+    
+    pwm.period_ms(10);
+    pwm.write(0.5f);
+}
+