|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
help with timed function
So I have searched for a few days for any examples of what I am trying to do but I cannot seem to find it.
Here is what I need to do: press of button (x) turns on solenoid 1 while the button is pressed and turns off when the button is let go. However when the button is let go I need it to trigger solenoid 2 for say 3 seconds then turn it off. I have gotten it to work where I press the button and it triggers solenoid 1 and when you let go it triggers solenoid 2 and turns off solenoid 1. The issue is that I dont want solenoid 2 left on all the time. Can anyone show me an example of how to time this? any help will be greatly appreciated! |
|
#2
|
|||
|
|||
|
Re: help with timed function
You have two options to add this to teleop.
One approach is to use a state machine directly in teleop code. You add a shift register or a global or other state data to remember that the code needs to do something in the future. Each time through, you check the state data to see if it is time to do the deed. When done, you clear it. The other approach is that you put the code to close the solenoid somewhere else that is always running, like in Periodic Tasks. It mostly sleeps, but occasionally wakes up to see if you are telling it to do something. When you open the solenoid, you set a global telling it when to close the solenoid. Greg McKaskle |
|
#3
|
|||
|
|||
|
Re: help with timed function
Thank you for the responce however I am so new with labview I have no idea where to begin with those instructions. It would be much appreciated if there was anyway you could show me an example of this.
Thanks in advance. |
|
#4
|
||||
|
||||
|
Re: help with timed function
Quote:
The next link is to what I consider one of the best sites to use to learn LabView concepts for FRC. FRCMastery.com is an exceptional place to become competant at coding in LabView for FRC. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|