Unable to get 3-wire sensors to work with V5

I am using C++ pro in VCS and am trying to use a potentiometer to select my autonomous like I have in previous years but have been unable to make it work. I declared the pot in the config screen using the correct syntax from the API, and then attempt to use it in autonomous to select my routine:


 vex::pot Pot = vex::pot(Brain.ThreeWirePort.B); 

void autonomous( void ) 
{
    if(Pot.value(vex::analogUnits::range8bit) < 400)
    {
        dist = 400;
        forward();
    }
    else if(Pot.value(vex::analogUnits::range8bit) < 800)
    {  
    }
    etc.
}

I can see the potentiometer value in devices on the brain screen, but it will run the code in the first if statement regardless of the pot’s value. I tried using percentUnits::pct and rotationUnits::deg with the same result. I previously had tried to use a bump sensor for another application and while I could see its value on the brain screen, the code ignored it as well. Any help would be appreciated.

Are you testing against 400 and 800 every time or have you changed those limits as well? Because 8 bit, percent, and degrees values will always be less than 400 for a potentiometer.

Is there a reason to not use 12bit for the potentiometer? Unless you want to really narrow the range of motion.

Thanks for the responses. I was previously unaware of the difference between 8, 10, and 12bit. I tried changed it to 12bit but it still did the same thing. Whenever I changed the units I always changed the values to match the units.

I had been starting the autonomous using the joystick. I just tried using the competition switch instead and everything work perfectly.