Is this how you code solenoids in autonomous?

Is this how you code solenoids in autonomous?

1 Like

Missing a screen shot?

Maybe. Maybe not. We’d need some code to know for sure.

Oops, here is the other screenshot!

You could put Solenoid sets in each of your for loops. - maybe consider moving the code the is the same for each for loop (the Drive VI, the NT Write, and the delay) into a subVI to reduce duplicate code that you have to update all occurrences of (for instance, to add a Solenoid Set).

Also, check out:, making your list of actions into one sequence or loop can be a lot easier to read.

There are many many ways to do programming. It looks like what you have may work. Be careful not to trigger the safety timeout on the drive motors.

To make your code more flexible and easier to read, consider the following:

  1. Make a generic move routine subVI It will have the loop inside. Use input parameters to control the time and speed.

  2. Make another routine just to control the solenoid. This one can do its work once, so it doesn’t need an internal loop. Because it is so fast it also doesn’t need to write to the drive motors. (If you add a loop you might want to incorporate the drive code too. If you wait too long to write to the drive motors, they will time out…)

Here is a crude example…

Here is the inside of the move subVI.

Here is a link to a resource that talks about how to create the timers. (See chap 2)

Oops… I forgot the wait in the auto fwd routine… It should look like this.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.