Hi everyone! i am builting a 4WD bluetooth controled robot using Arduino mega. I have attached my code as word file you can see.
So the problem is with ‘case p’ (marked with red colour). This allows the robot to move autonomous, it’s in a loop until the robot receives another Bluetooth order. The thing is that then it moves to an obstacle and it passes the 20 cm which is the set limit to stop and recalculate course, it needs approximately 3 seconds to stop. And 3 seconds is a disaster. It crashes every time … Is there any way to make the code run faster or ‘case p’ to loop faster?
All ideas are welcome. Thanks in advance!
Robot code 1.doc (112 KB)