View Full Version : Programming a joystick button...
programmr
05-01-2009, 11:31
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.
Kingofl337
05-01-2009, 16:11
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
DavidAllen
05-01-2009, 16:13
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)
http://i43.tinypic.com/25s4vbn.png
This topic might also be helpful:
http://www.chiefdelphi.com/forums/showthread.php?t=70564
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.