Go to Post When I saw the title of this thread ("Reverse Robotics"), I thought "what, you get six weeks to take apart a robot or something??" - Katie Reynolds [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 22-02-2012, 19:04
Ian McShane Ian McShane is offline
Registered User
FRC #3585 (Rogue Robots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: NH
Posts: 141
Ian McShane will become famous soon enoughIan McShane will become famous soon enough
Button Command

is there a way to end a command when you press a button. EG.
"MoveArmDown" would be a command telling the arm to go down
"End" would be the syntax to end the command
"downSwitch" would be the button

downSwitch.whenPressed(End MoveArmDown)

What would "End" be?
__________________
in FIRST, it's process over product, and team over robot.
http://www.roguerobotsof4h.com/
Team 3585 Rogue Robots of 4-H
Reply With Quote
  #2   Spotlight this post!  
Unread 22-02-2012, 19:40
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Button Command

Quote:
Originally Posted by Ian McShane View Post
is there a way to end a command when you press a button. EG.
"MoveArmDown" would be a command telling the arm to go down
"End" would be the syntax to end the command
"downSwitch" would be the button

downSwitch.whenPressed(End MoveArmDown)

What would "End" be?
assuming you were using a motor:

buttonA.onPress(new LowerArm())

buttonB.onPress(new StopArm())

LowerArm never actually finishes but rather is interrupted by StopArm


**just make sure they both require the arm subsystem or you may have some explaining to do as to why the arm ate itself.
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 22-02-2012 at 19:42.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-02-2012, 23:59
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: Button Command

You can also do downSwitch.whileHeld(<command goes here>);

The whileHeld method will constantly call start() on the command (which means if the command stops, it will restart, but otherwise there is no difference) while the button is held, and then it will cancel the command when the button is released (so the command will die, calling its interrupt method).
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 09:53.

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