Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Assigning Joystick Buttons? (http://www.chiefdelphi.com/forums/showthread.php?t=133590)

Team3220 27-01-2015 20:15

Assigning Joystick Buttons?
 
New programmers here! We have some code written, but we don't know how to assign joystick buttons to code. Like, how would we assign a relay or a motor to, say, button 2 on our Joystick? Which VI do we edit to assign the buttons? :confused: Thank you! -The Rookies

Mark McLeod 27-01-2015 23:01

Re: Assigning Joystick Buttons?
 
to pick the button use Joystick Get Values and Index Array.
There is an example here: http://www.chiefdelphi.com/forums/at...7&d=1421930245

What you do with the button to control the motor or relay can be a Case structure, a Select, or some other decision making vi.

Team3220 29-01-2015 14:07

Re: Assigning Joystick Buttons?
 
that's very helpful, thank you. but how do we connect the buttons to, say, a relay or motor or something? do we have to drag out a selector or something from the comparison tab?

Mark McLeod 29-01-2015 14:49

Re: Assigning Joystick Buttons?
 
What do you want to happen when button 1 is pushed?
For instance, operate as long as the button is held and stop when the button is released?

Run a motor forward, backward, stop, half speed/full speed?
A Relay can be any of these conditions: off/forward/reverse/on. What do you want the button to do?

Team3220 29-01-2015 14:59

Re: Assigning Joystick Buttons?
 
We are using mecanum drive, and we want to rotate the robot using buttons 4 and 5 on the joystick (3 and 4 in the code, right?) Also, we want 2 window motors attached to spike relays to rotate forwards and lift our arm up while button 2 on the joystick is being pressed, and set the arm back down by reversing the motors with button 3.

Mark McLeod 30-01-2015 19:23

Re: Assigning Joystick Buttons?
 
1 Attachment(s)
Something like this?

Team3220 31-01-2015 21:49

Re: Assigning Joystick Buttons?
 
That is very helpful, thanks. What exactly do those selectors do/tell the computer to do?

pastelpony 01-02-2015 00:53

Re: Assigning Joystick Buttons?
 
Those selectors take the boolean input that is given by a button press (True for pressed, False for not) and act accordingly. For example, in Mark's example (on the right), a press button 1 on Joystick 0 sets the relay to forward when pressed and off when not; similarly, press on button 2 on the same joystick sets the relay to reverse. You can also use a case structure for joystick buttons (and I actually prefer these). These work the same way; by taking the boolean input and executing the appropriate process according to it's value.

Team3220 01-02-2015 14:30

Re: Assigning Joystick Buttons?
 
That makes sense. Thanks a lot- it's "mentors" like you guys that make FRC fun.


All times are GMT -5. The time now is 08:50.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi