Working with two joysticks and a Cortex

I did a little testing with the legacy joysticks.  It turns out that the exact code that we use for the Vexnet will work on channels 5 and 6 if you want discrete outputs.
Channels 5 and 6 put out a -127 when the upper button is pushed(nearest the antenna) and 127 when the lower button is pushed if you call them with this code:
// Bottom Buttons – Joystick 1 crystal
//RT_5Down =  vexRT[Ch5]; // Returns 127 or 0
//RT_5Up =    vexRT[Ch5]; // Returns -127 or 0
//RT_6Down =  vexRT[Ch6]; // Returns 127 or 0
//RT_6Up =    vexRT[Ch6]; // Returns -127 or 0
If you call them with the vexnet joystick code… you get 1 or 0 for the crystal joysticks.
I.e.
// Side Buttons Vexnet,Bottom Buttons Crystal – Joystick 1
RT_5Down =  vexRT[Btn5D]; // Returns 1 or 0
RT_5Up =    vexRT[Btn5U]; // Returns 1 or 0  Up is nearest the antenna on crystal
RT_6Down =  vexRT[Btn6D]; // Returns 1 or 0
RT_6Up =    vexRT[Btn6U]; // Returns 1 or 0  Up is nearest the antenna on crystal
Debug still has the vexnet joystick connected to the programming port.  When the crystal rx is plugged in to either rx1 or rx2 it automatically disables the vexnet joystick but still allows debug through the programming port.
Here is a c test program that contains a proposed Joystick_599() function that reads both joysticks of either type.  Nothing has to be changed in the code to use the crystal joysticks.
The only difference in names is the use of RT2 for joystick 2… E.G.
RT_5Down for joystick 1
RT2_5Down for joystick 2
More stuff on Joysticks

Advertisements

One Response to Working with two joysticks and a Cortex

  1. Andrew says:

    Good to know stuff. Thanks for the info

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: