This year with shooting something again I promised my team the ability to simply press a button on the joystick and a motor will run until pressed again (essentially a latch) as opposed to last year the motor being controlled by a joystick itself. I thought I had finally figured out the solution which I have a screenshot of below, but it doesn't seem to work right. When the button is pressed, the motor starts up for about a second, then shuts off. This repeats indefinitely until I press the button again to stop (or disable the robot). There are rare chances I can spam the button in certain ways and get it to run forever, but that is really inconsistent.
all 3 are of the same code but it is showing what is inside the case structures
Do you guys have a solution to this specific code, or a new code that works better for what I need?
Thanks