Terrabots / Mbed 2 deprecated Motor

Dependencies:   mbed

Dependents:   DumpTruck turn_pot

Revision:
2:33be70fd7c4b
Parent:
0:a8839a6b9e39
--- a/main.cpp	Tue Sep 20 19:35:30 2016 +0000
+++ b/main.cpp	Mon Sep 26 21:59:45 2016 +0000
@@ -1,13 +1,31 @@
 #include "mbed.h"
 #include "Motor.h"
 
+Motor turn(p23, p28);
+AnalogIn pot(p15);
 Serial pc(USBTX, USBRX);
 
-Motor m1(p24,p30); 
-//Motor m2(p23,p28); 
-//Motor m3(p23,p28); 
-//Motor m4(p23,p28); 
+int main() {
+    pc.printf("%f", pot);
+
+    turn.write(0.3f);  //drive forward for 2 seconds
+    wait(2);
+    turn.write(-0.3f);  //drive backward for 2 seconds
+    wait(2);
+    turn.write(0);  //stop for 2 secs
+    wait(2);    // 
+    
+}
 
-int main() {
-    m1.write(1.0f);
-}
\ No newline at end of file
+
+//NOTES ON TURNING
+/*
+at start up, store the starting pot value
+for each direction +/- 0.15 float- those are the approximate limits of the turn
+when turning we have to consider two values:
+    velocity (speed and directional bit)
+    duration (the wait delay)
+    we need to find the experimental relationship between these two
+
+Limit switch just 0 and 1, nothing special
+*/