Two toggle button to activate a LED

Hi, i have a problem in using 2 toggle buttons to light up an led.

let's say toggle A (TA) and toggle B (TB) are the toggle buttons.
The LED should light up only when TA then TB is pressed. When TB is released LED should be off.

In my mind:
a) Since its a toggle button, how do we hold or keep TA value and compare to TB (both high) to activate the LED ?
b) how do we set all button state in off before running ?

Thank you all in advance.

In that order? Or just when both are pressed at the same time?

What about TA?

Hello
Is this a school assigment, isn´t it?

1st : yeap thats the order TA then TB.
press TA then release, then press TB (LED light up) , release TB(LED off)

2nd: TA press once before TB.

yea some kind like it, trying to get the basics right.

Since this is a school project, ill give you a small code piece that explains what happens:

void loop(){
  if (digitalRead(TA) == HIGH){ // if the TA button is pressed
    while (digitalRead(TB) != HIGH); //wait for the TB button to be pressed
    while (digitalRead(TB) == HIGH);  //wait for the TB button to be released
    digitalWrite(LED, HIGH);  //turn on the LED
    while (digitalRead(TB) != HIGH);  //wait for the TB button to be pressed
    while (digitalRead(TB) == HIGH);  //wait for the TB button to be released
    digitalWrite(LED, LOW);  //turn off the LED
  }
}

thank you, kind of clear now.

Now do you actually mean a toggle button? The word toggle means change the state, so a toggle button would mean every time it is pressed it will change its state. This is also known as a latching switch or a push on push off switch.

I suspect you actually mean a momentary push button which is what that code is written for.

Yes. I assumed he meant momentary "tactile" buttons, but I forgot to confirm that with @devinbabu .

hi, yea i meant by momentary push button

i meant the toggle as momentary push button, sorry for the miss concept.

OK but remember in future to use the right words. It is important in all walks of life but especially in a technical / science subject.