solving task by only using one delay?

Hi
I have this task I must have solved, but I must only have one delay in the code, by using variables to count times in the unit 100 ms. The task is:

• LED1 / pin 3 should flash once per second, on for 500 ms and off for 500ms.
• LED2 / pin4 must follow the switch on input 8.
• LED3 / pin5 must have an on / off time corresponding to the potentiometer at A0, where the value 0 must give

I know how to write this code using several delays, but how do you only use one delay?

If you mean delay() then you can write it without using delay() at all

Take a look at Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE

You can combine code in the following tutorials

As your assignment says: Use a counter variable.

When the counter reaches 5 (5 x 100ms = 500ms) toggle the led and reset the counter.

//LED1 / pin 3 should flash once per second, on for 500 ms and off for 500ms
counter = counter + 1;
if (counter == 5) {
  //toggle led
  counter = 0;
}

//LED2 / pin4 must follow the switch on input 8.
//...

//LED3 / pin5 must have an on / off time corresponding to the potentiometer at A0, where the value 0 must give
//...

delay(100);

Edit:
Although I agree with others here, the more correct and accurate way is to not use delay at all.
However I don’t know if your course will give credit for a solution like that given the way to solve the problem is given in the assignment...

recently I wrote some example code for timimg based on a counter variable
the example-code is in post #18

example-code based on millis() and a counter-variable

The advantage of using millis() instead if delay is that millis() is non-blocking while delay is blocking

If you write some demo-code that shows the blocking of delay() and how the blocking can be overcome with millis(). You will go far and beyond duty.

The basic idea for this democode is: counting turns of a switch and print the counted turns of the switch in the serial-monitor.
This exercise includes to write 4 or 5 small programs with serial-output to learn from the serial-output what is happening inside the code. This will take 2 - 4 hours of experimenting with the code.
If you find this approach interesiting and are willing to invest the time I will support you.

If you see this task just as a "must for the teacher" and after finishing this task you don't want to write code anymore for the rest of your life. Read the given links and try to solve it yourself.

best regards Stefan