[FTC]: Joystick Issues

Hi. As our team starts to work on some side projects over the summer, I’ve run into an issue with the joystick controller. To test it, I created a simple debugging program, but I still can’t figure out why the joystick fails to work.

No matter where the joystick is, RobotC (code) seems to think it’s still at (0,0), however, when bringing up the joystick control debug window, I can clearly see that RobotC can see the joystick movement. I’ve tested this in several different programs so far. I just wanted to make sure that I wasn’t making some sort of systematic error in the code, so here is an example of the issue.

#include "JoystickDriver.c"
task main()
    if (joystick.joy1_x1 != 0 | joystick.joy1_y1 != 0) 
    	writeDebugStreamLine("Test successful.");

If anyone could provide any insight, that’d be great.


if (joystick.joy1_x1 != 0 || joystick.joy1_y1 != 0)

You are doing a bitwise OR with | and you want to do a logical OR ||

That solved it, thanks!