if (sharp_IR_reading > scan_thresh)//object detected
{
if (scan_angle>41) //overflow protection
scan_angle-=2;//scan right
}
Here why do we need to make that overflow protection? I mean couldn`t we just say
if (sharp_IR_reading > scan_thresh)//object detected
{
scan_angle=scan_angle
}