Go to Post Lucky breaks and trying to minimize failures or moments of retardedness are what these games are all about, like any sport. - Bill Gold [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-01-2015, 20:15
Team3220's Avatar
Team3220 Team3220 is offline
Mechanic of Mayhem
FRC #3220 (Mechanics of Mayhem)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Washington
Posts: 21
Team3220 is an unknown quantity at this point
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? Thank you! -The Rookies
Reply With Quote
  #2   Spotlight this post!  
Unread 27-01-2015, 23:01
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 27-01-2015 at 23:05.
Reply With Quote
  #3   Spotlight this post!  
Unread 29-01-2015, 14:07
Team3220's Avatar
Team3220 Team3220 is offline
Mechanic of Mayhem
FRC #3220 (Mechanics of Mayhem)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Washington
Posts: 21
Team3220 is an unknown quantity at this point
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?
Reply With Quote
  #4   Spotlight this post!  
Unread 29-01-2015, 14:49
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-01-2015 at 14:52.
Reply With Quote
  #5   Spotlight this post!  
Unread 29-01-2015, 14:59
Team3220's Avatar
Team3220 Team3220 is offline
Mechanic of Mayhem
FRC #3220 (Mechanics of Mayhem)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Washington
Posts: 21
Team3220 is an unknown quantity at this point
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.

Last edited by Team3220 : 29-01-2015 at 17:20.
Reply With Quote
  #6   Spotlight this post!  
Unread 30-01-2015, 19:23
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Assigning Joystick Buttons?

Something like this?
Attached Thumbnails
Click image for larger version

Name:	Sample.png
Views:	74
Size:	30.1 KB
ID:	18065  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #7   Spotlight this post!  
Unread 31-01-2015, 21:49
Team3220's Avatar
Team3220 Team3220 is offline
Mechanic of Mayhem
FRC #3220 (Mechanics of Mayhem)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Washington
Posts: 21
Team3220 is an unknown quantity at this point
Re: Assigning Joystick Buttons?

That is very helpful, thanks. What exactly do those selectors do/tell the computer to do?
Reply With Quote
  #8   Spotlight this post!  
Unread 01-02-2015, 00:53
pastelpony's Avatar
pastelpony pastelpony is offline
Programmer/Electrical
AKA: Zach M
FRC #3525 (Nuts and Bolts of Fury)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 152
pastelpony will become famous soon enough
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.
__________________
Team 3525 Head Programmer (2014- ) - Java (Formerly LabVIEW)
Reply With Quote
  #9   Spotlight this post!  
Unread 01-02-2015, 14:30
Team3220's Avatar
Team3220 Team3220 is offline
Mechanic of Mayhem
FRC #3220 (Mechanics of Mayhem)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Washington
Posts: 21
Team3220 is an unknown quantity at this point
Re: Assigning Joystick Buttons?

That makes sense. Thanks a lot- it's "mentors" like you guys that make FRC fun.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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