Three wire ports not working during autonomous


During autonomous, three wire sensors almost never output correctly. what


You should post your code so the community can better help you.


Here is basically everything that matters here:

//In robot-config.h
vex::sonar sonar = vex::sonar(Brain.ThreeWirePort.C);

//In main.cpp
void auton(void) {


It prints 0, when it should print -1 or some other number.

also, @jpearman, do you know if there is an issue with auto, threads, and threewireports?

Edit: trying not to confuse people


you cant use auto because its a keyword in c++


paraphrasing, thats not the actual function name


you mean using three wire ports during autonomous ? No problems as far as I know.


I just tested this, no problems at all.

vex::sonar       Sonar( Brain.ThreeWirePort.C );

void autonomous( void ) {
    while(1) {
      Brain.Screen.printAt( 10, 40, "Sonar %.2f", Sonar.distance(distanceUnits::mm) );

remember that the Sonar.distance method returns a double, that may be your issue.