Joystick Trigger Programming

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.

If anyone knowns how to program limit switches that would be helpful as well. Thanks again.

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

Thank you all

…which the 2009 rules do not permit using, alas.

You could use the GetTrigger function or use Button1 if you’re using the standard joystick…

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
}