Loop servo in teleop

We have a servo that currently moves from 0 degrees to 45 degrees on our robot and allows fuel to enter our shooting mechanism. Currently, it operates when a joystick button is pressed (the same button that starts our fuel shooting motor).

I would like to make the servo move back and forth between positions in 1-second intervals when the button is pressed, but can’t figure out how to do it. I thought I would use a while loop that runs when the button is pressed and put the select that moves the servo to 45 degrees inside it, but it still only moves once. The other way I can think to do it is use a flat sequence structure, but I want to make the servo move back and forth indefinitely when the button is pressed. Any help would be appreciated. Thanks!

Post the vi with the while loop version and I’ll help troubleshoot it.

Here is my teleop VI.

Teleop.vi (35.2 KB)


Teleop.vi (35.2 KB)

The same thing happens. The servo rotates, but only once. We have to press the button for it to move multiple times. Out of curiosity, the joystick input to the case structure was still there but not wired to anything. Was this intentional?

Here’s an iteration.

I added an AND for the joystick button, and handled the 1 sec check a little differently.
I just forgot to add a joystick button check.

Teleop-new.vi (32.3 KB)


Teleop-new.vi (32.3 KB)

Thank you Mark! This works, and saved me a lot of time and confusion. It ended up being far more complicated than I thought it would be. I plan to eventually learn more about feedback loops, but ran out of time this season.

Again, thanks for your help!

You’re welcome.
I know it’s really getting late for everyone and you just want to see the robot work before it goes in the Bag tonight.

Some of it is knowing that a certain function exists.
The feedback nodes just remember what the value was the previous time through, so you can compare the current value to the previous value.