The distance sensor is only to stop the thing from crashing into the stops ad both ends of the track. The travel then return is/can be handled by timing the travel. Hmmm, I probably made it appear more complicated than it is. What I have working now: track is 14 ft long, the Arduino mini driving a continuous rotation @ 6v takes 48 seconds to travel from one end to the other using the servo sweep example by adjusting the time. the plan: This doesn’t have to be exact, using that idea break up the time into 4 pieces and have them run consecutively. The sensor only stops that script and starts another which runs the servo in reverse which is then replayed …
I picked up the Programming Arduino - Getting Started with Sketches book today and hope to get a handle on this.
other books I have: Getting started with Arduino ,Practical Arduino and Programming Interactivity.
I plan to Give Lab View a try, any thoughts on that or any type of graphical programming software?