View Full Version : Joystick Trigger Programming
dnrobotics11
06-02-2009, 19:34
I am using WindRiver and all of the posts for the trigger programming are for LabVIEW. Could anyone help me with the programming of the buttons on the joysticks in WindRiver? Thanks a lot.
dnrobotics11
06-02-2009, 19:35
If anyone knowns how to program limit switches that would be helpful as well. Thanks again.
byteit101
06-02-2009, 20:13
Joystick stick(1);//channel 1
if (stick.GetRawButton(1-11))//1 is the trigger button, 2-11 the buttons labled as such
{
...
}
DigitalInput di(1);//channel 1
if (di->Get())
{
...
}
Is there not a GetTrigger function in Joystick.h?
I don't have the header files here, but i think there is one. (you can check)
EDIT:
in Joystick.h, there is a GetTrigger function, as well as just the normal numbered 1-11 buttons
virtual bool GetTrigger(JoystickHand hand = kRightHand);
bool GetRawButton(UINT32 button);
that is from the header file, so you would just use GetTrigger and GetRawButton
Byteit is good on the limit switch too,I think not sure, that the Jaguars also have built in limit switch support, no code required
dnrobotics11
07-02-2009, 15:26
Thank you all
Alan Anderson
07-02-2009, 19:10
...Jaguars also have built in limit switch support,...
...which the 2009 rules do not permit using, alas.
kyungjin
09-02-2009, 06:52
You could use the GetTrigger function or use Button1 if you're using the standard joystick...
csshakka
09-02-2009, 19:27
You can use the GetTrigger() function. Something like this:
Joystick *stick;
stick = new Joystick(1);
if (stick->GetTrigger())
{
// Code if trigger is held
}
else
{
// Code if trigger is released
}
Buttons are similar, but you use the GetRawButton() command.
Joystick *stick;
stick = new Joystick(1);
if (stick->GetRawButton(1-11))
{
// Code if button is held
}
else if (!stick->GetRawButton(1-11))
{
// Code if button is released
}
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.