Hi. I am trying to make a button that changes the velocity. I want 2 fixed velocities, so it will make life a lot easier for me to code it, but I still have No idea how to. I am using vexcode pro. Thank you!
You will need to have a variable to store the desired velocity.
Then use an if statement testing for button press to change that variable.
Set motor speed to the previously mentioned variable.
Gotcha. I will try to get that working today.
and you will need a latch to change from one state to another.
Try this topic:
If I remember right, there is a solution to your problem there. You will need to do a little bit of looking, but the same general problem was solved here.
My team achieved this with an if else statement alone. we are updating it now.
When you press the button does the programming continuously jump back and forth between the two values ? Or how did you overcome this issue that other teams have had in the past?
We had the button held down to switch the speed and experimented with pressing to switch the speed.