Go to Post I tried, but our freshmen lost enthusiasm about filing the blocks of aluminum I gave them into Andymark Performance Wheels after only a few hours! - Greg Woelki [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-01-2017, 10:39
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 213
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
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
Reply With Quote
  #2   Spotlight this post!  
Unread 20-01-2017, 11:03
couvillion couvillion is offline
Registered User
FRC #1818
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: shreveport LA
Posts: 53
couvillion is an unknown quantity at this point
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
Reply With Quote
  #3   Spotlight this post!  
Unread 20-01-2017, 11:06
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 213
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi