So I have a question about joysticks...

I need a little help. I want to have a program that can read the joystick value in order to use a potentiometer i.e.

if((joystickvalue>="whateverreading")&&(SensorValue[Potentiometer]>=1050))
{
motor[whatever] = 0;
} 

If anyone could give a little help that would be fantastic!
-Jake

I’m a little confused on what you’re trying to accomplish with this program, you said,

but in the program, you are checking a potentiometer’s value, therefore using the potentiometer.

Are you trying to program a motor on the robot to respond to a joystick input from the controller?

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; 
  }

you could also combine the first two cases I suppose with an OR statement

if(((joystickvalue>=0) && (SensorValue[Potentiometer]<=upperlimit)) || (joystickvalue<0))
  {
  motor[whatever] = joystickvalue;
  }
else
  {
  motor[whatever] = 0; 
  }

Thank you so much for the suggestion/solution. Helps a lot!