View Single Post
  #2   Spotlight this post!  
Unread 02-04-2013, 07:51
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote