Go to Post So please, think twice before you click that little button that says "reply". - Ken Leung [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-01-2009, 11:31
programmr's Avatar
programmr programmr is offline
Registered User
AKA: Face
FRC #0522
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Staten Island, NY
Posts: 83
programmr is a jewel in the roughprogrammr is a jewel in the roughprogrammr is a jewel in the rough
Send a message via AIM to programmr
Exclamation Programming a joystick button...

Hello,

I'm curious as to how i would program the button labeled 2 on the logitech joystick connected to USB port 1 on the ds. like for example.... When button 2 on joystick 1 is pushed, set relay 8 to fwd on the NI9472 module or something like that.

Any help would be greatly appreciated.
__________________
"I would love to change the world but no one will give me the source code"
  #2   Spotlight this post!  
Unread 05-01-2009, 16:11
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Programming a joystick button...

In your code you should have something like
Joystick *leftstick;

then further down you should have
leftstick = new Joystick(1);

make sure leftstick matches the name of your joystick object.
var = leftstick->GetRawButton(button number);

Thats it
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
  #3   Spotlight this post!  
Unread 05-01-2009, 16:13
DavidAllen DavidAllen is offline
Registered User
FRC #2415 (The Westminster Wiredcats)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Atlanta
Posts: 5
DavidAllen is an unknown quantity at this point
Re: Programming a joystick button...

By going to WPI Robotics Library -> RobotDrive -> Joystick -> Get and placing it down in your main loop, there is an output called "buttons". This output is a bundle, which can be unbundled with Cluster, Class, ... -> Unbundle. Connect the wires and you should see a rectangle with 12 slots, representing the 12 buttons on the default controller. Then, you would link each of the slots with a case structure (Structures -> Case Structure) and add your drive code in it.

Here's a picture of what it should look like (sorry if its not the convention for posting LabVIEW code on the site. I'm not sure what it is)


This topic might also be helpful:
http://www.chiefdelphi.com/forums/sh...ad.php?t=70564
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
button programming joesmomh00haha Programming 12 10-02-2007 10:36
Using a button on a joystick to track? DemonYawgmoth Programming 5 12-02-2006 11:17
Joystick Hat button ten3brousone Programming 8 20-02-2005 13:31
Joystick Button programming Bharat Nain Programming 5 18-02-2005 11:48
Joystick Button Deference cibressus53 Electrical 3 01-11-2004 09:38


All times are GMT -5. The time now is 03:13.

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