Printing values from the VEXNET Joystick

Is there any way to run the debugger while controlling the robot with the VEXNET Joystick (remote controller)? It’d be extremely useful to be able to see what values are being read in from the joysticks on the controller while the program is running on the Cortex. It doesn’t seem like this is possible though since there is only one USB port on the Cortex.

There are two fairly simple ways of viewing the values…

In ROBOTC 3.0 or newer, if you go to Robot > VEX Troubleshooter > VEXnet Joystick Viewer, it will open a window that displays all of the joystick, button, and accelerometer values for joystick 1 and 2. For this to work, your joystick must be connected to the computer using the USB-to-Serial programming cable, and the robot and joystick must both be turned on and synched.

Alternatively, you can assign the values of the things you care about to variables, and watch them in the Global Variables Debug window.

task main ()
{
  int channel3Value;
  int channel2Value;
  
  while(1 == 1)
  {
    channel3Value = vexRT[Ch3];
    channel2Value = vexRT[Ch2];
    motor[leftMotor]  = vexRT[Ch3];   // Left Joystick Y value
    motor[rightMotor] = vexRT[Ch2];   // Right Joystick Y value
  }

}

In order to do this, how exactly would the Cortex, joystick, and PC all be set up and connected? Do we need to have the joystick connected to the PC through the USB-to-serial, and then the joystick also connected to the Cortex through USB-to-USB? If so, then how do we connect the Cortex to the PC so that we can run the debugger on the Cortex to display the global variables? It would be great if we could have the Cortex running the robot and reading commands from the joystick while simultaneously displaying data on the debugger or debug stream.

You’re on the right track. You connect a USB port on your computer to the PROGRAM port on the VEXnet Joysticks using the USB-to-Serial programming cable.

You then connect the Cortex and Joysticks over VEXnet (assuming you’ve already synced them) or the USB A-A cable.

You then download and run your programs as if the Cortex were directly connected, except ROBOTC will use the wireless connection between the joysticks and Cortex to get the debugger information.