Log in

View Full Version : Declaring Second Joystick


DiedandLived
10-02-2012, 15:29
I have had issues attempting to make certain code only apply to the joystick in port 2, however it merely puts all the code into the first joystick. Any suggestions would be great!

DiedandLived
10-02-2012, 15:57
Basically how do we declare a second joystick in C++.

mikets
10-02-2012, 15:59
class MyRobot: public SimpleRobot
{
Joystick stick1;
Joystick stick2;

MyRobot(): stick1(1),
stick2(2)
{
}
...
void OperatorControl()
{
if (stick1.GetRawButton(1))
{
}
else if (stick2.GetRawButton(1))
{
}
}
};

Supernovapsy
11-02-2012, 18:25
Yeah, different numbers should be assigned to the joysticks.