| |
A couple of observations about your code.
1) You set up the move function, but then you don't use it consistently. Instead of using a for loop to make each movement, you could have much simpler code. For example, instead of the for loop marked with the comment "Forward 24 inches," you could add an array for those pulse durations (1286 and 1655), together with the rest of the arrays:
int slow_forward[2]={1286, 1655};
Then, you can pass this array to the move function, together with the number of times that you want the movement to repeat(176):
move(176, slow_forward);
2) I'm not sure that I understand exactly what you want your robot to do, but I think that you should make all these moves before you start the while loop that contains the if-else statements for your sensors. That way, the robot will complete the pattern on the floor and then start monitoring the sensors. |