View Single Post
  #3   Spotlight this post!  
Unread 23-02-2013, 12:35
Itamar's Avatar
Itamar Itamar is offline
Registered User
FRC #1943 (NeatTeam) & FRC #4590 (GreenBlitz)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Israel
Posts: 83
Itamar is an unknown quantity at this point
Re: Command-Based robot button toggle question

Changing WPILib's code is a bit risky, I wouldn't do that. You could, however, write some classes of your own that demonstrate similar principles. What I would do is define a "ToggledPressedButtonScheduler" class:

http://pastebin.com/agFtqpAN
http://pastebin.com/bZwmbD21

It's based on "PressedButtonScheduler", but starts a different command every time the button is clicked. Here's how you should use it:

http://pastebin.com/SmBGNhFu

Please note that the code was written in pastebin and was not tested (or compiled).
Reply With Quote