I have built a Robot that is controlled remotely via a control panel on a web page (Left, Right, Forward, Backwards), for vision it has a Web Cam mounted on it. The robot has an Arduino Nano ATMega328P connected to a Raspberry Pi via 2 wire i2c. The motors are connected to and driven by the Nano and the Raspberry Pi serves the Web Page and Web Cam.
The problem I am having is finite control, when I click on Left for instance the motors run too long resulting in the robot spinning too far. What I need to be able to do is have better control.
I have tried reducing the PWM but the motors don't run unless they are on full speed so I need another way of doing this.
Someone suggested using the Millis() command to specify the length of time a function runs for.
Any help with implementing Millis() in this way would be appreciated.