Using multiple sub ifs/else ifs in an if statement

Hi, I know my subject is written badly, but I hope someone can understand. What I want my code to do is check which out of 3 buttons is pressed and then follow that statement in order.

for example:

//when button1 is first, and button2 is pressed second.

if (button1 == HIGH){

do...stuff

if((button1 == HIGH) && (button2 ==HIGH) && (button3 == LOW){

do..more stuff
}

}

// here I add another option when button2 is pressed first, and button 1 second. But, what happens is it always uses the first IF and not this one bellow.

if (button2 == HIGH){

do..stuff

if((button2 == HIGH) && (button1 ==HIGH) && (button3 == LOW){

do..more stuff
}
}

any ideas?

You need to check the switches in the correct order to get the behavior you want. You MUST check states that depend on multiple switches before states that depend on only one switch.

Regards,
Ray L.

What you need is a state machine to remember what has been/is pressed and in which order to decide what to do
And of course don’t compare the PIN number with HIGH or LOW, use digitalRead()