I want to be able to program my robot with a bumper so that when it hits something it will stop then turn around and keep going until it hits something else.I have no idea how to do this!!
Can you help??
Easy, what programming package are you using…?
RobotC | EasyC | MPLab
Assuming you know how to do it it looks something like this (I use easyC so I’m not sure how exactly to write the code)
while (bumper == 1) //unpressed?
bot goes forward/backward
//outside the while loop
bot turns left/right for a bit
The code should loop back up to the top which happens to be the unpressed statement.
Basically what’s happening is the bot backs up while the bump sensor isn’t pressed. The moment it’s pressed, the robot will turn for however far you program it for and then loop back to the back/forward until the sensor is depressed again.
I have EasyC.
I have the same issue here…Can someone help?