Custom code not working with joystick
Page 1 of 1

Author:  joshuav [ Wed Nov 18, 2015 6:28 pm ]
Post subject:  Custom code not working with joystick

My group and I have been attempting to solve this issue for a while now, and I finally bit the bullet and made an account here.

Here is our code (not all of it, just an example):

task main() {
    while (1 == 1) {
        if (vexRT[Btn8U] == 1) {
            motor[port2] = 63;

Now, without the if statement, the code works and can be run from the computer. However, we want to make this code work when the cortex is not connected to the computer, as the code makes the robot move through an obstacle course. We know we can just eliminate the if statement and turn the robot on at the start of the obstacle course, but we would prefer to start the code whenever we click the button (not least for practice with RobotC). This isn't so much about making the robot move through the obstacle course as it is about making the robot move when the button is pressed.

The cortex and joystick have been updated numerous times to 4.25, the cortex and joystick are power-cycled each time the code is re-downloaded, and both the computer and cortex are set to USB-only communication. The cortex and joystick both have enough battery power. When we press the button after everything is turned on, nothing happens. What are we doing wrong here?

Author:  Tabor473 [ Fri Nov 20, 2015 2:46 pm ]
Post subject:  Re: Custom code not working with joystick

Okay so if they are set to USB only communication than they won't connect over Vexnet. That means that your joystick is not connected and your button press wouldn't be sent to the robot.

What do the lights look like on the joystick and the cortex?

Author:  joshuav [ Sat Nov 21, 2015 7:36 pm ]
Post subject:  Re: Custom code not working with joystick

We connected the controller with a USB cable, and the two were connected according to the lights on the joystick and the microcontroller.

The problem was fixed when we switched over to the competition template and put this code into the "usercontrol" task. What I don't understand is why it didn't work with just the normal default task ("main")?

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group