Reading a sequence of digital inputs -> take action based on sequence

Hi All,

Newbie to Arduino language and worked out a lot of things reading this forum and following tutorials/books but now I am trying to read a sequence from three digital inputs (switches basically). If the sequence is correct I want to put another digital pin to output HIGH. If it's not I want a led to turn on.

I have trouble looking in the right direction.. would I need to use an array for this? Or a string?

If the sequence is fixed in the code then all you need is if/else.

But perhaps there's more to it than you've said so far?

Steve

but now I am trying to read a sequence from three digital inputs (switches basically). If the sequence is correct

What do you mean by "sequence"? Are you suggesting that the order that pins go HIGH (or LOW) is important?

Hi Guys, i basically found what i want and its working, just needed to change one bit of code to get it working (And need to debounce the buttons)..

http://forum.arduino.cc/index.php?topic=144748.15

(userInput[pwcount]

should be

(userInput[n]

in the unlocked part of the code in this example.