DistanceGP2Y0A21YK Dist01; //defines Dist01 as the sharp GP2Y0A21YK
Dist01.begin(A0); //tells program "Dist01" will be used by the serial monitor
/*Although below, it says "getDistanceCentimeter", it really converts the data into Inches---make a very big note for this!!*/
if ((Prox01 <= 10) || (Prox02 <= 10)) Steering.write(125);else if ((Prox04 <= 10) || (Prox05 <= 10)) Steering.write(65);else if ((Prox01 <= 15) || (Prox02 <= 15)) Steering.write(115);
Haha thanks! I'm looking to improve the algorithm for obstacle avoidance, but I'm not sure how to do it. Instead of listing a million if statements, I wasn't sure if I could accomplish this with a few for or while loops. Can it be done?