Example to move the robot.

Dependencies:   m3pi mbed

Fork of 3pi_Line_Follow by Craig Evans

Files at this revision

API Documentation at this revision

Comitter:
eencae
Date:
Thu Mar 22 12:13:29 2018 +0000
Parent:
1:d8c15d5b8eac
Commit message:
Initial commit

Changed in this revision

code.cpp Show annotated file Show diff for this revision Revisions of this file
main/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/code.cpp	Tue Mar 20 16:37:12 2018 +0000
+++ b/code.cpp	Thu Mar 22 12:13:29 2018 +0000
@@ -3,7 +3,18 @@
 // code in here runs again and again
 void repeat()
 {
-   // put your code in between the { and } brackets
-   
+    // move both motors at 25% speed, the robot should move forwards
+    robot.left_motor(0.25);
+    robot.right_motor(0.25);
+
+    // carry on going forward for 2 seconds
+    wait(2.0);
 
-}
\ No newline at end of file
+    // make robot spin right (clock-wise)
+    robot.left_motor(0.25);
+    robot.right_motor(-0.25);
+    
+    // you can change this value to tune the turning angle
+    wait(0.5);
+
+}
--- a/main/main.cpp	Tue Mar 20 16:37:12 2018 +0000
+++ b/main/main.cpp	Thu Mar 22 12:13:29 2018 +0000
@@ -26,7 +26,7 @@
 {
     init();
     welcome();
-    calibrate();
+    //calibrate();
 
     float dt = 1.0/50.0;