|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
How does ToggleWhenPressed() work?
Hey CD,
I was wondering how wpilib's ToggleWhenPressed() function worked in C++. My goal is to make a command that extends a pneumatic cylinder when a button is pressed and then when you press the same button again, it retracts. I think the function is useful because it fits into how I structure my commands where all commands are called from the OI class. I didn't see any documentation about how it works. Any help is appreciated. Thanks, Drew |
|
#2
|
|||
|
|||
|
Re: How does ToggleWhenPressed() work?
The docs such as they are.
http://first.wpi.edu/FRC/roborio/sta...39d57549395530 If you really want to know then https://github.com/wpilibsuite/allwp...nScheduler.cpp This should give you the answer on how to make your command do the two actions |
|
#3
|
||||
|
||||
|
Re: How does ToggleWhenPressed() work?
Hmmm ok. So the command has to be running for it to toggle on and off. Thanks for the help.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|