Is the second transmitter connected?

Is there a way to programmatically determine if the second transmitter is connected? I want to have the control scheme automatically switch if the second transmitter is connected, powered on, and linked.

Unfortunately, there’s no simple variable to check to see if its connected.

You could check/wait to see if a button is pressed on the 2nd transmitter, and then create the logic you’d like. Something like…

while(vexRT[Btn5DXmtr2] == 0)
// wait here

//control scheme

That’s a shame. There really should be a variable for checking that.

I tried getting the accelerometer values for the second controller, to check them against NULL (because gravity is always applying force), but for some reason I was not able to get those values at all…

Anyways, I just implemented a button switch on the first controller to switch between single and double controller mode.

Make sure you weren’t using one of the newer “Partner” joysticks. It does not contain an internal accelerometer.

And actually, jpearman reminded me that we do have a variable that allows you to do this: vrXmit2

My apologies, I honestly forgot about it.

Ah, thanks, that was just what I needed!

Also, because it might be unclear to whoever is reading this, vrXmit2 is a bitmask for the nVEXRCReceiveState global variable, so to check if a second controller is connected you can use this:

bool xmit2Connected = (nVEXRCReceiveState & vrXmit2);