easyC code responds differently when tethered to joystick vs pc

Hey guys

Reached a dead end here, finally got most of the code running properly… with the exception of one small thing that has me stumped :confused:

I have a section of code that changes the servo positioning based on a reading from the accelerometer.

When I run the code with the Cortex tethered to the PC (so I can read values printed in the online window) the code does not change the servo positioning at all.

When I run the code with the cortex tethered to the joystick via USB a-a cable, the code works as it is written, except the servo resets itself to the neutral position… and there is no line in the code asking it to do so.

I have no idea what is going on, and why the robot would respond differently if its tethered to the PC or the joystick.

Thanks Again!

Which accelerometer? The one in the joystick or the 3-axis small board (which is what I assume you mean otherwise why test without the joystick).

Can you post some code?

I found out at a tournament that the Easy C platform disables the motors when tethered from PC to the cortex via a USB cable. I did not know this or expect this. We were troubleshooting the lack of motor motion problem and brought up the ‘on line control’ interface to test each of the motors and suddenly they started working. Later another team explained they believed it is a safety mechanism in Easy C to prevent inadvertent motor movement when tethered directly to the PC via USB cable.
I haven’t thought about this much since we use Vex Net to get information from the cortex. If you don’t want to use VexNet (I’m not sure why not as you would have the joystick in line as well) you can try to bring up the online control and enable the motors then proceed to your debugging. If that doesn’t work you might try posting in the official Easy C forum and see if they can help.
Cheers Kb

Because batteries. Lots and lots and lots of batteries.

Thanks for the responses. As for the accelerometer, its not the one in the joystick, but the externally mounted vex one.

The servo works fine in the online window. e.g. moving the sliders will move it one direction, and vice versa.

I just have no clue why it resets back to the neutral position after a few seconds.

If you want to share the code we may be able to help, but otherwise it’s hard to guess what may be wrong.

I sent you a message :smiley:

I tried to duplicate this and failed. The motors ran when the cortex was tethered to the PC directly or via the joystick. One thing to remember is that when using USB direct to the PC, power will go via the USB cable and power the cortex, however, if the battery is not turned on the motors will not run.

I just tried this as well and could not duplicate the situation either. When I saw it last time the team was using the version of Easy C 2 releases or so back, so that could have been something release dependent, and not in the current release.