Hi there Everyone.
My last 2wd rover project (cyclops), ran the motors for periods of time based on delays, as in:
Turn motors on
Delay
Turn motors off
I want to add edge detection to the project, so i can run it on a desk. stage one is to replace the delays with "wait without delay" functions, to allow me to monitor the front sensors while it moves.
As far as i can see i have done what i think i should do but it doesnt work.
This should be the code, on paste bin:
http://pastebin.com/qvZrQjUj
It is seperated into tabs in my sketch, I have pasted the other tabs (which contain various voids) into the sketch, just above the loop.
This is how i THINK it is working (except it isnt working)
Create three interval timers, lines 42, 43, 44. Current time, previous time, and the interval in millis.
at the end of setup, start the "current" clock. Line 109.
the system carries out direction scans (voids vert and hori) as defined in the loops phase.
once it has carried these out, it defines "previous as current" line 296
it then carried out movements based on the directions determined in the sweeps. the movements are under the void "decisions" which start at line 159. there are three options, one each for straight on, right and left. The associated references to the time intervals are in each of these sections.
The bot still turns in the correct directions, but continues to spin, until the servo scan is completed again. I want it to write a "release" at the end of the intervals.
once i have it working with a basic interval of 1000, i will write the intervals as variables, depending on the angles detected.
(However that is the next phase. i had it working like that perfectly when i was using delays, hence the reference to Vert and Hori Delays which currently dont do anything)
Any advice would be great. Cheers All!
PS, my bizzare post formatting is supposed to make it easier to see the details in the post, hope it helps!