Multiple positions with one button

Hello, I’m trying to set two buttons to have different outcomes when the button is pressed multiple times. On my claw i’m running an IME and the button will be 5d. I’m trying to get it to the point where one press grabs and holds the cone and a second press releases it to a point. The second system that i’l use one button for is the linear lift. There i need it to move to specific cone heights while also resetting to ground level on each alternate press.

A method like this but one button for the lift.
A finite state machine may be what you are looking for.

@Wingus or Dingus do i just run while loops in each of the case statements?

Can anyone show me a version of this code running with any pid values set in it or a video demonstration?

If you’re looking for an example, the code for OSIZR basically does what it sounds like you want. You can find the code and a video in the reveal thread.

That being said, it might be better to start with something simpler, post it here, and then ask us how to change it to get closer to what you want.