Muio need this code, remove only part of the scanner! help me .. please.
void scan()
{
//swap scan directions
/*psuedocode
while object is detected
scan left while object detected
while object not detected
scan right until object detected*/
target_distance = analog(A3);//check sensor
if (target_distance > distance_thresh)//object detected
{
if (scan_angle>-20) //overflow protection
scan_angle-=1;//scan left
}
else //object not detected
{
if (scan_angle<130) //overflow protection
scan_angle+=1; //scan right
else //if scanned all the way, this forces it to start over
scan_angle=-20;
}
//servo scan code
output_bit(PIN_D2, 1);//139 center
long_delay_us(130+scan_angle);
output_bit(PIN_D2, 0);
//printf("angle: %ld distance: %u\r\n", scan_angle, target_distance);//debug code
}
?
does not work, do not know if that is ..
HELPPPPPPPPPPPPPPPPPPPPPP