Stopping a program, start another, then go back


i'm new arduino , taking on little project. have droid i'm building out of scrap. want head sweep left, right, stop in middle. wait few, left, right, stop in middle again.
to make more difficult regular "sweep" example, have ir sensors in chin. i'd them able detect motion, stop sweep program , using ir, follow movement until it's out of range, go left right sweeps.

i see on multiple sketches in 1 sketch, i'm not sure that's i'm looking for. need stop "sweep" sketch, go ir motion detector sketch , when invalid (no more movement in front of ir) go sweep program.

is beyond scope of arduino uno?? again, i'm new , maybe not using correct search terms find i'm needing

look while loops. "while x true y"

for timing don't try use delay instead millis method counts number of milliseconds arduino has been running. recording unsigned long @ given point in code can subtract current time see how time had passed. if desired amount of time has passed reset counter.

sorry can't give example right because i'm on handheld computer.

cheers,
rhys


Arduino Forum > Using Arduino > Project Guidance > Stopping a program, start another, then go back


arduino

Comments