How would I go about creating a variable that is defined by the robot, not one that I type in, that I can use as a comparison value that only changes when I push a button when sensor values change?
How to create a “Robot Defined” Variable
How would I go about creating a variable that is defined by the robot, not one that I type in, that I can use as a comparison value that only changes when I push a button when sensor values change?
Are you using RobotC or EasyC?
No need to ask the same question in multiple forums.
I’m not sure quite what you are asking, here is a variable that changes when I press a joystick button (in ROBOTC)
task main()
{
int a;
while(1)
{
if( vexRT Btn8U ] )
a = 12;
else
a = 8;
wait1Msec(25);
}
}
We are using robotC. we are trying to program two potentiometers on on the lift and one on the pickup to keep the pickup level. The way I understand the team is that they need one pot set at a variable and the other to conform to that variable as the lift moves up and down keeping the pickup level. Sorry about the double posting.
So are you trying to basically code a lift PID controller? If so, then my personal recommendation would be to program a separate button for each lift height in drivers, and then use tasks to start and end in sync with the aforementioned button. That way you would automatically have manual control of the lift whenever you are not pressing a button.