Running loop with button..

Basically I want to press a button, let go, and I want the motors to run continuously until the limit switch is pressed and then roll back for 3.9 sec then stop. I gotten to that point as shown in the code below, but I haven’t gotten to the point on the code below. I can run everything while holding the button but I just want to press and let go. This goes in my

When the center Case structure is true, its just a simple set output motor vi with a value of 1.

Don’t put that in Teleop. The 3900 millisecond delay in there will bring everything else in the code to a halt, including the communication with the Driver Station, and the system watchdog will shut down the robot’s outputs.

Do you know how to use the Flat Sequence structure? One of those in a neverending While loop placed in the Periodic Tasks vi is probably the right way to implement what you want. The first frame of the sequence will stop the motor and have a loop waiting for the button to be pressed. The second frame will run the motor and have a loop waiting for the limit switch. The third frame will reverse the motor and delay 3.9 seconds. If that’s not enough of a hint, let me know.

Here’s what I was trying to describe.

So I just delete every thing that was in the and post it in the example in the periodic