Sophia, an autonomous robot based on Tamiya kits

Revision:
0:db79273ace80
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sophia.cpp	Thu May 09 02:45:44 2013 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "Motor.h"
+#include "Sophia.h"
+
+Motor motor_right(PTD4, PTC13, PTC12);    // pwm, fwd, rev
+Motor motor_left(PTD4, PTA13, PTD5);
+
+void Sophia::move(float speed, int direction) {
+    if(direction) {
+        motor_right.speed(speed);
+        motor_left.speed(speed);
+    }
+    else {
+        motor_right.speed(-speed);
+        motor_left.speed(-speed);    
+    }
+}
+
+void Sophia::turn(float speed, int direction) {
+    if(direction) {
+        motor_right.speed(0.0);
+        motor_left.speed(speed);
+    }
+    else {
+        motor_right.speed(speed);
+        motor_left.speed(0.0);
+    }
+}
+void Sophia::spin(float speed, int direction) {
+    if(direction) {
+        motor_right.speed(-speed);
+        motor_left.speed(speed);
+    }
+    else {
+        motor_right.speed(speed);
+        motor_left.speed(-speed);
+    }
+}
\ No newline at end of file