When I needed to activate something via the Xbox 360 controller, I used the wpilib triggers functionality.
My GetTrigger.h (C++)
Code:
#ifndef GetTrigger_H
#define GetTrigger_H
#include "WPILib.h"
class GetTrigger: public Trigger
{
private:
int m_axis;
Joystick* joy;
public:
GetTrigger(int, Joystick*);
bool Get();
};
#endif
And GetTrigger.CPP
Code:
#include "GetTrigger.h"
GetTrigger::GetTrigger(int axis, Joystick* Joy)
{
joy=Joy;
m_axis=axis;
}
bool GetTrigger::Get()
{
return joy->GetRawAxis(m_axis)>0;
}
You just declare an object of Type, in this case, GetTrigger in your OI as defined in your constructor and Initialize it like a JoystickButton. If I'm too vaugue, just look in the WPIlub documentation on Triggers
here.