Servo control with ultrasonic sensors


hi please me this, need robot turn right when serial read there 2cm difference in readings of hc-sro4 sensors if perhaps tell me how can change below turn if difference between 2 sensors more 5cm or that.



code: [select]
if(cm > cm1) //if left receiving senors greater right receiving senor turn right
{
rightservo.write(50); //set right motor speed , direction
}


thanks in advance

code: [select]
abs (cm - cm)


Arduino Forum > Using Arduino > Project Guidance > Servo control with ultrasonic sensors


arduino

Comments