davef21370 wrote:Sounds fine but just as a matter of interest what's doing what?
I'm guessing the Pi is controlling the robot by user commands in manual mode and the Arduino is handling sensors and sending commands to the Pi for automatic mode?
If so I'd drop the delay to say, 15 seconds, before it goes automatic but warn the user it's about to change (beep/flash/spin/whatever) and just detect a carriage-return to return to manual mode.
Dave.
Dave thanks for the response - yes the Pi is serving a Web Page using WebIOPi which has a control panel and a video stream from a WebCam mounted on the Robot. This enables the user to remotely navigate and control the robot and send commands to the Nano to operate the motors. The Arduino has an HC-SR04 Ultrasonic Sensor mounted on it but handles the Auto mode itself.
I have a couple of issues with it at the moment:
1. The lag on the camera is way to slow to be useable to drive it around (I am using Mjpg-Streamer).
2. I cannot make fine turns left and right, when you click the 'Left' button on the Web Page and even if you immediately release the button which then sends a 'Stop' command the turn runs for about a second in which time the robot has spun 180 degrees!! I think this is because of a code induced delay of 1 second to avoid overload on the i2c Serial Bus, I may try and reduce it or play with the Arduino Code to run a command for a specified amount of Milliseconds using the Millis() function in Sketch which looks like it can be used to check how long a piece of code has been running and then do something? It is demonstrated here
https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay.