hi just got my first arduino uno board and ad-fruit motor shield but still trying to get my head around the programing
i have built the following base to experiment with but finding it hard to get started. i have an old r/c car as base with the motor connected to motor 1 on the motor shield. the steering is by a servo connected to header 1 on the same board. i have 2 ldrs connected to input 0 and 1 respectively.
by trying various sketches i have found i know the motor runs, the servo steers and each light sensor works OK.
but can not get them all to work together. what i am trying to do is car will steer towards the strongest light but if unable to go forwards will reverse and try another way.
this project is supposed to help keep me busy as i have very bad depression so if someone can help me with my first project it will give me confidence to continue.
thank you
AL
It sounds like you have made a good start, in that you have gotten each component of your project to work separately. I suggest you try combining two functions, and then testing. For instance, combine the two ldr's with steering changes; something like:
if (ldr1 < ldr2) then steer left
else (ldr1 > ldr2) then steer right
else go straight
Get that working, then work on your detection of an obstacle. You will either need an additional sensor to detect that the car has hit an obstruction, or if the motor shield has a current sensor, you can use that to determine that the motors have stalled. The ldr's will not really be able to detect an obstacle. If you run into problems, simply post your sketch that your having a problem with and give a good description of the error/issue your having and someone will help!