What I’m trying to do is when the potentiometer gets to a certain point and I input a Y-value onto the controller’s joystick, it can only move downwards, not upwards. I know I kind of explained in a meh way, sorry for the confusion.
Untested code, and I’m only learning robotc this year, but here’s one way to do it (there may be more graceful ways)
if((joystickvalue>=0)&&(SensorValue[Potentiometer]<=upperlimit)) //motor commanded to go up and is still below potentiometer limit
{
motor[whatever] = joystickvalue;
}
else if(joystickvalue<0) //motor commanded to go down
{
motor[whatever] = joystickvalue;
}
else //remaining cases, which is motor commanded to go up but it is above the potentiometer limit
{
motor[whatever] = 0;
}