Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: [FTC] putting two selector values in a case structure (http://www.chiefdelphi.com/forums/showthread.php?t=113389)

Tyguy56 12-02-2013 23:52

[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?

l0jec 13-02-2013 10:01

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?

ferret_guy 13-02-2013 11:03

you can use boolean operators like this,

if ((button(7)&&button(8))=true)
then{ do stuff}
else
go on with life

aklego 13-02-2013 17:12

Re: [FTC]: [FTC] putting two selector values in a case structure
 
1 Attachment(s)
The attached snippet should do what you are asking:


All times are GMT -5. The time now is 18:22.

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