Go to Post There is nothing that compares to the smell of burning flesh, especially when it is your own. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
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 12-02-2013, 23:52
Tyguy56 Tyguy56 is offline
Registered User
FTC #3385
 
Join Date: Feb 2013
Location: Minnesota
Posts: 6
Tyguy56 is on a distinguished road
Question [FTC]: [FTC] putting two selector values in a case structure

I'm trying to put two selector values in a case structure so they work together for example, when using a button event how would i change the case structure so that a motor would not move until i pressed two buttons such as pressing buttons 7 and 8 to move a motor. i currently only know how to have it set to one button but as our mechanisms can only be deployed once i want to program it so it will only deploy after pressing two buttons h ow would i do this?
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2013, 10:01
l0jec l0jec is offline
Registered User
no team
 
Join Date: Oct 2009
Rookie Year: 2004
Location: St. Louis, MO
Posts: 52
l0jec has a spectacular aura aboutl0jec has a spectacular aura about
Re: [FTC]: [FTC] putting two selector values in a case structure

How were you planning to use case statements for button presses even without the two button scenario?
I ask because the different buttons being pressed are not mutually exclusive and it is not clear to me what value you'd even be switching on.

You may be better off using if/else statements for the logic you've described?
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2013, 11:03
ferret_guy ferret_guy is offline
Registered User
AKA: Mark Omo
FRC #1703 (RATS)
Team Role: Leadership
 
Join Date: Mar 2012
Rookie Year: 2008
Location: Henderson
Posts: 97
ferret_guy is on a distinguished road
you can use boolean operators like this,

if ((button(7)&&button(8))=true)
then{ do stuff}
else
go on with life
Reply With Quote
  #4   Spotlight this post!  
Unread 13-02-2013, 17:12
aklego aklego is offline
Registered User
FTC #3595 (Schrödinger's Hat)
Team Role: Mentor
 
Join Date: Oct 2009
Rookie Year: 2004
Location: Alaska
Posts: 89
aklego is just really niceaklego is just really niceaklego is just really niceaklego is just really nice
Re: [FTC]: [FTC] putting two selector values in a case structure

The attached snippet should do what you are asking:
Attached Thumbnails
Click image for larger version

Name:	two button.png
Views:	28
Size:	13.7 KB
ID:	13980  
__________________
let tau = 2pi
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 17:12.

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