|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Button Sequence Input
Is there a relatively simple way, with WPILib or without, to make the code be able to detect an input of a sequence of buttons as oppose to holding them all down? Like a cheat code.
For example, if the driver entered the sequence A B X Y on an xbox controller some LEDs would flash. This mean that they are only pressing one at a time but in sequence. |
|
#2
|
||||
|
||||
|
Re: Button Sequence Input
Code:
int state = 0;
while{
if buttonA && state == 0
state ++;
if buttonB && state == 1
state ++;
if buttonX && state == 2
state++;
if buttonY && state == 3
state ++;
if buttonBack
state = 0;
if state == 4
{action
state = 0;
}
|
|
#3
|
||||
|
||||
|
Re: Button Sequence Input
Quote:
As the code stands, the sequence A B Z X Y would be accepted. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|