Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of 3pi_Line_Follow by
Diff: code.cpp
- Revision:
- 1:d8c15d5b8eac
- Parent:
- 0:008c53db1931
--- a/code.cpp Tue Mar 20 16:28:07 2018 +0000
+++ b/code.cpp Tue Mar 20 16:37:12 2018 +0000
@@ -1,32 +1,9 @@
#include "main.h"
+// code in here runs again and again
void repeat()
{
- float speed = 0.5;
-
-
- robot.scan();
-
- // in range -1 to 1, no error when line is at 0.0
- // number is negative when the line is to the left
- // number is positive when the line is to the right
- float position = robot.read_line();
-
- robot.display_data();
-
-
-
- float step = 0.4*position;
- // + when line to right
- // - for line to left
-
-
- if (position < 0.0) { // line to the left...need to turn left
- robot.left_motor(speed+step);
- robot.right_motor(speed);
- } else { // line to the right...need to turn right
- robot.left_motor(speed);
- robot.right_motor(speed-step);
- }
+ // put your code in between the { and } brackets
+
}
\ No newline at end of file
