Reversing Relay for motor

reversing a relay is my next big issue; those solenoids was more of a “protect my own hide”

  1. button pressed, motor spins “1”. button released, motor stops
  2. another button pressed, motor spins “-1”. button released, motor stops

any ideas? I would somehow have to get a “negative true” to the relay in order to reverse it.

I looked at the included example, it didn’t make any sense at all. :confused:

Here is what I think might work in response to my own question. The buttons give TorF values, which in turn produce 1, -1, or 0. T produces 1 or -1, respectively, and F gives 0 on both. They are then added, so that
TF gives 1,
TT gives 0,
FT gives -1, and
FF gives 0,
which then go to the reversing relay. Can someone please advise whether this would work?


The Relay Set VI does not take values on the 1 to -1 scale. Look at the help for this VI to see which values correspond to which relay directions/values.

One way to do this is nested case structures. Another way to do this (and the way I will explain) is to use two Select VIs in series. The Select VI is found in the Comparison palette.

The Select VI takes 3 inputs. The middle input determines which of the other two inputs is passed through. The top input is passed through if the middle is true. The bottom input is passed through if the middle is false.

You want to make a Relay Set VI, right click on the Relay Value terminal and create a constant. Disconnect the constant from the terminal.

Make a Select VI and wire the middle terminal to one of the buttons. Wire the top terminal to the constant and set the constant to the direction you want the relay to go when that button is pressed (Forward or Reverse). Copy the constant and wire it to the bottom terminal and set it to Off.

Make a second Select VI and wire the middle terminal to the other button. the top terminal should be another copy of the constant set to the opposite direction. The bottom terminal should be the output of the first Select VI.

The output of the second Select VI goes to the Relay Value terminal of the Relay Set VI



It makes sense…

I’ll work it tomarrow.


This makes the most sense out of anything I’ve programmed to date, and a beutiful solution.

Thanks a whole bunch! :slight_smile:

Hey we are a Rookie team and i was wonding how do you change the RelayValue input to blue… sorry dont know much about this program yet


It’s pretty simple, for every input and output to a function, if you hover your mouse over the wiring port to get the wiring mouse icon, right click, then go to create -> Constant, it will make a constant of the right type (you can do the same with controls and indicators). It’s much faster than going into the number pallet or whatever.

In case you were wondering, the blue thing that says “Off” or “Forward” or whatever is called an “enum.” The data type is simply a number, but the datatype makes it so that when there’s a control or constant it gives a word instead of a number. In this case, it’s much easier for the user to select “forward” than to remember that forward is 2, so they used an enum. They’re in the numeric pallet, and you add the text by right clicking on them and selecting “Edit” (you can also do that to see which name is which number).

I assume that’s what your talking about, because there are several different “blue things” :stuck_out_tongue:

Ok thanks i will try that tonight…:smiley: