What integer should be used for a motor?

What integer can I use for a motor? I want to use the integer for an if statement. I will be using the if statement to stop a motor at a certain point or to prevent our claw from going above a certain point.

I think what you are looking for is the encoder value of the robot. Assuming you meant to post this in the VEXCode support, rather than the RobotC support, you would first need to make sure that your robot’s claw always started at the same position to act as zero. Then, after figuring out the maximum height you want to go to, you could limit movement in the joystick. The pseudocode would be something along the lines of
if(encoder value in degrees or anything of the motor < maximum threshold){
if(button or joystick triggers moving up){
code to move the claw up

I’m assuming that the claw is connected by an axle, and if I was in that position, I would use a potentiometer. That way, you don’t have to worry about setting the claw at the right position always, but instead could refer to something that keeps an constant value outside of the program.

1 Like