Case Structure

This is going into Teleop. I didn’t use a Select block because I only want it to go Reverse when I push it. Would this accomplish what I want? Or am I breaking my robot?

Restraint-Teleop.vi (12.3 KB)


Restraint-Teleop.vi (12.3 KB)

The way you have it now, it will always go in reverse, no matter whenther the button is pressed or not.

What do I need to do to change that?

Change one of the cases (True or False) from “Reverse” to “Forward”

Right now both cases set the solenoid to Reverse.

BTW, a Select block can do the same thing.

But won’t it go back to forward after I let go of the button?

That’s what your code does now.
It will revert when you let go of the button.

The Select is just a special 2-case Case.

There are easy ways to make the button toggle for either approach.

The toggle vi I found here
https://www.google.com/url?q=https%3A%2F%2Fwww.dropbox.com%2Fs%2Fz3uonmx6op0inxv%2FToggle.vi&sa=D&sntz=1&usg=AFQjCNE_hGUhNrnas6H4-XtvmfI_oiGQqA

Would that work? And I can code into periodic tasks a solenoid position switch without breaking the togglability right?

That Toggle example would work fine, and it’ll work in Periodic Tasks.

So if i have code in Periodic that resets the position to forward, the toggle will still work right?