In the meantime I have learned that the delay function is unusable for this, as it stops the program as long as it lasts.
I have found the "blink without delay" sketch, which made me a bit more confused.
I'm figuring out the Wokwi app, as soon as I managed to model the wiring I'll post it.
const int LED1 = 13;
const int LED2 = 12;
const int LED3 = 11;
const int buttonPin1 = 10;
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// put your setup code here, to run once:
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(buttonPin1, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED1, HIGH); //turn on led 1
delay(2000); //keep led on for 2sec
digitalWrite(LED1, LOW); // turn off led1
delay(100); //wait 0,1 sec
digitalWrite(LED2, HIGH); //turn led2 on
delay(2000); //keep led2 on for 2 sec
digitalWrite(LED2, LOW); //turn led2 off
delay(100); //wait 0,1 sec
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin1);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(LedPin1, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin1, LOW);
}