I am using DAQmx to acquire and generate digital inputs and outputs to run a car forward and reverse, triggering off of lasers. The trip lasers are normally High (1) and then go low (0) when something breaks the beam. The code attached functions. The car drives forward when you press start, drives to the end and when the laser is tripped it flips to reverse and comes back. When it gets to the left sensor it trips and goes forward and keeps doing that. I have been trying to figure out how to stop the car (output 0 to FWD and REV) for a second before it flips direction and I can't figure it out for the life of me. Any help is appreciated. Maybe there is a better way to do it all together???
If it is any use:
Forward output: Mod4/port0/line1
Reverse output: Mod4/port0/line0
Left sensor input Mod3/port0/line1
Right sensor input Mod3/port0/line0