Range in Values

Hello, i was doing some programming and for the condition for my while loop, i wanted to have a range for my potentiometer. What would be the easiest way to do this?

I’m not sure that you have given us enough information to help you.
What compiler are you using? RobotC? Can you post your code.

Here’s a guess at what you might mean.

Assumptions: Using robotC. You want the arm mechanism to move quickly while the potentiometer is in some midrange of it measurement; here between 512 and 2048. Also, that you’ve written a function which moves the arm. The moveArm function takes two parameters, armDirection and armSpeed. The value of armDirection is set before you get to the loop.

while ( (SensorValue[myPot] > 512)  && (SensorValue[myPot]<2048) )
{
    // Use high power for faster movement
    armSpeed = 95;
   moveArm(armDirection,armSpeed);
}

The while condition will be true until the arm moves the potentiometer out of the indicated range.