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.
Diff: main.cpp
- Revision:
- 27:aa81c15e5c1d
- Parent:
- 25:806e67a1218f
- Child:
- 28:add6c7e2f0d3
--- a/main.cpp Sat Mar 28 21:08:53 2015 +0000
+++ b/main.cpp Sat Mar 28 21:21:13 2015 +0000
@@ -79,7 +79,7 @@
bool turn_left=false;
bool turn_right=false;
- float bullshit_offset = .08;
+ float bullshit_offset = .075;
// major loop
while(1) {
@@ -164,7 +164,7 @@
// checking for center line (single line)
- for (uint16_t i=15; i<113; i++) {
+ for (uint16_t i=10; i<118; i++) {
if ((*(TFC_LineScanImage0+i) < 450)) {
black_values_list[black_value_count] = i;
black_value_count++;
@@ -187,7 +187,7 @@
uint8_t num = 0;
- if(center_now > 15 && center_now < 27)
+ if(center_now > 10 && center_now < 27)
num = 1;
else if(center_now >= 27 && center_now < 54)
num = 2;
@@ -195,7 +195,7 @@
num = 15;
else if(center_now >= 54 && center_now < 81)
num = 4;
- else if(center_now >= 81 && center_now < 113)
+ else if(center_now >= 81 && center_now < 118)
num = 8;
else
@@ -223,9 +223,14 @@
//if (black_center_value > BLACK_THRESHOLD+30) {
if (num==8 and right_counter <.2 )
{
- //left_counter += (128-black_center_value);
- //left_counter+=20;
- left_counter=-0.4;
+
+ if (center_now <113)
+ left_counter=-0.4;
+ else
+ {
+ if (left_counter > -.15)
+ left_counter=-0.15; // less drastic for outside parts
+ }
turn_left=true;
turn_right=false;
@@ -244,10 +249,14 @@
//else if (black_center_value < BLACK_THRESHOLD-30) {
else if (num==1 and left_counter >-.2)
{
- //right_counter += black_center_value;
+ if (center_now >15)
+ right_counter =.4;
+ else
+ {
+ if (right_counter <.15)
+ right_counter =.15; // less drastic for outside parts
+ }
- //right_counter +=20;
- right_counter =.4;
turn_left=false;
turn_right=true;