El mayor problema es que enciende si pulsas 1 y 2, 2 y 1, 1 y 1, 2 y 2.
Una posible solución:
const int buttonPin1 = 2;
const int ledPin = 13;
const int buttonPin2 = 4;
int i = 0;
void setup()
{
pinMode(buttonPin1, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
}
void loop()
{
int pin1State = digitalRead(buttonPin1);
int pin2State = digitalRead(buttonPin2);
if (i == 0) {
if (pin1State == LOW)
{
i = 1;
}
}
if (i == 1) {
if (pin2State == LOW)
{
i = 2;
}
}
if (i == 2)
{
digitalWrite(ledPin, HIGH);
i = 0;
}
delay(500);
}
Te toca hacer la segunda parte (apagado)
Saludos