Teleop Servo Loop

I had help here a couple of weeks ago concerning a servo that needed to rotate from 0 to 45 degrees in 1-second intervals continuously whenever a joystick button is held. That code is working great.

However, our drive team has determined that we need the servo to move to 45 degrees for 1 second and move to 0 degrees for 2 seconds, and repeat that continuously. Could someone show me how to modify the teleop vi (attached) to make this happen?

Thanks!

Teleop.vi (37.9 KB)


Teleop.vi (37.9 KB)

I was unable to figure out how to get your existing toggle code doing this (it will be interesting to see what Mark McLeod comes up with), but I’m attaching a modified version that uses a timer VI (attached) to accomplish this (I have tested it numerically - as in setup a loop and had it display - and it is based on the program I helped 4490 Tech Raiders come up with).

Basically, on timer, toggle a value and use it to determine the servo set point and the new duration of the timer (so the duration and position toggle every time).

http://i.imgur.com/UF2LEj9.png

I am attaching the timer VI (an FGV) and my edit to your telop VI.

The other side of the first case structure is another option for a toggle using the Breakaway Memory Libray

Teleop (1).vi (35.6 KB)
timer.vi (12.5 KB)


Teleop (1).vi (35.6 KB)
timer.vi (12.5 KB)