I am hoping someone can help end a discussion with our inexperienced programmers. We want to push a button once for a motor to start and push the same button a second time for the motor to stop. Can this be done? If so, how?

Are you using the command based framework 2020?


Added the motor to be clearer.

1 Like

use flag that turn true when the flag is originally false and false when it is originally true. Then run a function depending on the state of the flag.

Oh I’m sorry this is labview.

Go here. Do this…

Then use this new “One Shot Button.vi” to toggle a boolean control.

What your asking is if it is possible for a program to have memory - and there are many ways to do it.

Team 358 has this example:

FRCLabVIEWTutorials.com has this example:
(fourth in list) https://www.frclabviewtutorials.com/tutorials/memory-library/#example-usages
(this utilizes a the MemLib VI’s to do the memory and detect toggles).

Here is some sample logic and suggestions…

  1. First only use the button value when it changes from 0 to 1. This is called edge detection.
  2. Use a flip-flop (digital memory) to remember what you want.
  3. Consider using two buttons one for off and one for on. If the drivers can’t see what is going on,
    they may not know what action they are selecting with a single button.

Here is a screen shot of the logic.

You can find information on how to create the On EDGE and FLIP FLOP here.

Using two separate buttons, it would look like this.

Shrink that Index Array down to the number of elements you need. If they aren’t 0 and 1, wire an input in to select the element you care about.