Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Joystick Trigger Programming (http://www.chiefdelphi.com/forums/showthread.php?t=73771)

dnrobotics11 06-02-2009 19:34

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.

dnrobotics11 06-02-2009 19:35

Re: Joystick Trigger Programming
 
If anyone knowns how to program limit switches that would be helpful as well. Thanks again.

byteit101 06-02-2009 20:13

Re: Joystick Trigger Programming
 
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())
{
...
}

bwobo 07-02-2009 13:59

Re: Joystick Trigger Programming
 
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
Code:

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

Re: Joystick Trigger Programming
 
Thank you all

Alan Anderson 07-02-2009 19:10

Re: Joystick Trigger Programming
 
Quote:

Originally Posted by bwobo (Post 816003)
...Jaguars also have built in limit switch support,...

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

kyungjin 09-02-2009 06:52

Re: Joystick Trigger Programming
 
You could use the GetTrigger function or use Button1 if you're using the standard joystick...

csshakka 09-02-2009 19:27

Re: Joystick Trigger Programming
 
You can use the GetTrigger() function. Something like this:
Code:

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.

Code:

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
}



All times are GMT -5. The time now is 02:42.

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