View Single Post
  #3   Spotlight this post!  
Unread 23-03-2013, 17:37
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Run a series of instructions when button is pressed

Quote:
Originally Posted by cisasteelersfan View Post
What I've tried is putting a global variable that is true when the button is pressed. This gets passed to periodic tasks where if true, it runs a for loop four times. This outputs to another global variable that is passed to teleop that controls the solenoid (forward or reverse).
That seems kind of the long way around to do it. Why not just do everything in Periodic Tasks? Read the controller button and use it to either do nothing or run the For loop. Set the solenoid right there inside the For. Put the whole thing inside a While loop that has a 20 ms delay.
Reply With Quote