LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When a button is pressed move motor for x milliseconds?

Solved!
Go to solution

Hello! I hope we can get some help.

 

We've been able to program our joystick to move independent motors (using http://wpilib.screenstepslive.com/s/currentCS/m/labview/l/696735-how-to-use-joystick-buttons-to-cont... guidance), but now we need to make it so that when  button X is pressed it moves a motor for a few seconds and then stops, and when button Y is pressed it moves the motor the opposite way for a few seconds and then stops.

 

To put it another way in case I haven't been clear, instead of the motor stopping when the button is no longer pressed, we want it to move for a predetermined amount of time and then stop.

 

Really hope I'm making sense!

Thank you!

 

0 Kudos
Message 1 of 4
(2,748 Views)

Those motors appear to operate based on a number passed into the "Motor: Set output" VI, yes?

 

So... create a While loop that checks for button Y being pressed, and when it changes from "not pressed" to "pressed", run the "Motor: Set output" VI with a nonzero value, then put a "Wait" VI after it connected by the error chain, then put another "Motor: Set output" VI connected to the wait error chain with a zero passed in.

0 Kudos
Message 2 of 4
(2,729 Views)

It looks like you found the FRC forums a bit after you posted this.  Typically, you'll get more focused help there as most people posting in this section of the forums won't be used to the architecture you're looking at.

 

Depending on your architecture, I shared a different way to solve what you're getting into in that thread.

0 Kudos
Message 3 of 4
(2,703 Views)
Solution
Accepted by topic author robocoachpaul

You are absolutely right! I found the right place to post and got a great solution!

 

https://forums.ni.com/t5/FIRST-Robotics-Competition/When-a-button-is-pressed-move-motor-for-x-millis...

0 Kudos
Message 4 of 4
(2,688 Views)