Update for http://letsmakerobots.com/node/25837
Stops and reverses for a millisecond when it comes within 30 cm of an object for effective braking when it picks up speed. Looks left and right and chooses the direction with the most space. PWM to about 1/4 of the speed.
To drive the motors properly I ended up having to stack 4 sn754410 chips on top of one another to handle the current. Works great.
There is about a half sec lag between the response time of the right wheel after the left wheel. Not sure theres anything that can be done about this though. *Corrected this issue with a few tweaks to the code*
The speed is still an issue. Because of the gear ratio on the car itself it is a speed demon. If I alter the code to slow it down it won't be able to move properly. If I speed it up, it picks up speed quickly and moves faster than It can react to detected objects, which causes it to occasionally rams into things. Increased the distance to keep from objects to 30 cm from 20 cm to allow it more reaction time. Still experimenting on findind a suitable speed and distance. I added a huge bumper so it can ram into whatever it likes now without damaging itself.
Would like to add white led headlights to the front which turn on while it is moving forward, red led headlights to the rear which turn on as it backs up, and maybe green or blue leds somewhere which light as it turns.
Any ideas, suggestions, inputs or comments are welcome! nothing wrong with learning
UPDATE: Changed the code so it now looks left and right and makes the best choice where to go when it comes to an object. Added Brake Lights and headlights. PWM the speed to about 1/4 of what its capable of. Reverses for 1 millisec when it detects something for more effective braking... not bad for my first robot huh. Last Video Shows The Final Product