Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: Joystick Issues (http://www.chiefdelphi.com/forums/showthread.php?t=129975)

FTC7584 05-07-2014 10:04

[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.

Code:

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

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

Foster 05-07-2014 18:28

Re: [FTC]: Joystick Issues
 
Try

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

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

FTC7584 05-07-2014 22:28

Re: [FTC]: Joystick Issues
 
That solved it, thanks!


All times are GMT -5. The time now is 18:22.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi