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:
- 13:6ad980fd3394
- Parent:
- 12:288df1e95dec
- Child:
- 14:f43b386b8b5d
diff -r 288df1e95dec -r 6ad980fd3394 main.cpp
--- a/main.cpp Mon Feb 23 21:12:31 2015 +0000
+++ b/main.cpp Tue Feb 24 18:54:07 2015 +0000
@@ -118,7 +118,7 @@
// checking for center line?
for (uint16_t i=0; i<128; i++)
{
- if ((*(TFC_LineScanImage0+i) > 450))
+ if ((*(TFC_LineScanImage0+i) < 300))
{
black_values_list[black_value_count] = i;
black_value_count++;
@@ -132,17 +132,38 @@
black_center_value= sum_black / black_value_count;
- if (black_center_value > 64)
+ if (black_center_value < 64)
{
- current_servo_position = current_servo_position-.0001;
+
+
+ //current_servo_position= float(-0.2);
+ /*if(black_center_value < 40)
+ current_servo_position = current_servo_position-.0004;
+ else
+ current_servo_position = current_servo_position-.0001;*/
+
+ //current_servo_position= float(.009375*black_center_value-(.6));
+ //current_servo_position= float(.00625*black_center_value-(.4));
+ current_servo_position= float(.015625*black_center_value-(1));
if(current_servo_position <= -0.4)
current_servo_position = -0.4;
TFC_SetServo(0, current_servo_position);
+
}
- if (black_center_value < 64)
+ if (black_center_value > 64)
{
- current_servo_position = current_servo_position+.0001;
+ //current_servo_position = current_servo_position+.0001;
+ //current_servo_position= float();
+ //current_servo_position= float(0.2);
+ /*if(black_center_value > 88)
+ current_servo_position = current_servo_position+.0004;
+ else
+ current_servo_position = current_servo_position+.0001;*/
+
+ //current_servo_position= float(.009375*black_center_value-(.6));
+ //current_servo_position= float(.00625*black_center_value-(.4));
+ current_servo_position= float(.015625*black_center_value-(1));
if( current_servo_position >= +0.4)
current_servo_position = +0.4;
TFC_SetServo(0, current_servo_position);