LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Utiliser le bouton myRIO pour donner un signal constant.

bonjour à tous. je suis très nouveau sur myrio et labview, alors expliquez-moi comme si j'avais five ans.
mon problème est que je dois faire en sorte que le bouton de mon myrio donne un sign, puis continuer ce signal, lorsqu'il est pressé une fois. ensuite, je veux qu'il donne zero lorsqu'il est pressé à nouveau. je ne suis pas vraiment un programmeur, j'en ai juste besoin pour l'enregistrement de données sur une voiture électrique. quelqu'un peut-il m'aider ? merci d'avance.

0 Kudos
Message 1 of 2
(545 Views)

I'm relying on my High School French (and not asking my wife, who is fluent en Francais, to translate it for me).  I think you are asking how to transform the myRIO PushButton into something that, when pressed, "turns something on", and when pressed again, "turns it off" (like the Power button of an electric car).

 

As you know, the myRIO PushButton is a Boolean control, "True" while pressed, and "False" when let go.  

 

Do you know about While Loops in LabVIEW?  Consider a While Loop with "False" wired to the Stop terminal, so that it runs forever.  Do you know about Shift Registers?  They serve as a "m.emory" for the While Loop.  If you wire a "False" from outside the While Loop to the left Shift Register, and let the While Loop run, it will always hold that "False" value.  Suppose you slowed down the While Loop so it ran at 1 loop/second (do you know how to do this?  What if you put a "Wait (ms)" with 1000 wired to it inside the loop?) and wired a Boolean Indicator inside the While Loop and connect it (by a "wire") to the Shift Register?  It would always be off ("False").

 

Now put a "Negate" function inside the While Loop, connect the left Shift Register to its input, and its output to the right Shift Register.  What do you expect to happen when you run this little VI?  [I'm doing this all with words, because I want you to do the LabVIEW programming and learn LabVIEW].

 

Now put the Push Button inside the While Loop.  How would you alter the program you've been developing (you really need to do this little exercise, and see what happens at the end of the previous paragraph for this next step to make sense!) to have the Negate function only function when the myRIO's PushButton is pressed.

 

Once you get to this step, you are almost there.  Play around a bit, and you should be able to get a button push to "turn on the car" (when the Indicator flashes at 1 Hz) and a second button push to "turn off the car".

 

Have fun, and enjoy LabVIEW.

 

Bob Schor

0 Kudos
Message 2 of 2
(516 Views)