How to give LED 8 Hz flickering for 10, 20 and 30 seconds in a row?

Hello, I have only one LED, and I want to make various periods of time (10, 20 and 30 secons) of a flickering at 8 Hz in a row. I'm an amateur in ARDUINO. I have this, but I can´t give the duration.Can somebody help me?

void setup(){
pinMode(9, OUTPUT);

}

void loop(){

digitalWrite(9,HIGH);
delay(125);
digitalWrite(9,LOW);
delay(125);

}

That is currently roughly 4Hz because every on/off cycle takes 250ms.

What do you mean about various periods of time? What should happen after 10 seconds runs out? Do you want to control those time periods? Random? What is it you want?

Thank you very much for observing the 4 Hz.

What I need is a plickering of a LED at 8 Hz for 10 seconds, then turn off for 20 seconds, then start flickering at 8Hz for 20 seconds, then off for 20 seconds , and finally a flickering of 30 seconds.

Sorry but it's the easiest way I found to explain it.

Set up a timer to toggle pin 9 every ~65ms.
The code above is then enabled by a timer set to 10, 20 and 30 seconds as needed.

//   10,20,30
//
//

int reps;

void setup() 
{
  pinMode(13,OUTPUT);
}

void loop()
{
  for(reps = 0; reps < 80; reps ++)
  {
    blinkit();
  }
  delay(2000);
  
  for(reps = 0; reps < 160; reps ++)
  {
    blinkit();
  }
  delay(2000);
  
  for(reps = 0; reps < 240; reps ++)
  {
    blinkit();
  }  
  delay(2000);
}

void blinkit()
{
  digitalWrite(13,HIGH);
  delay(65);
  digitalWrite(13,LOW);
  delay(60);
}

Thank you very much for your help @runaway_pancake!

I managed to do it, what I need is to do 3 cycles of that and then the LED stays off. Is that possible?

what I need is to do 3 cycles of that and then the LED stays off. Is that possible?

Yes.
Just put the whole contents of the loop function into a "for" loop that runs three times, and have a

while(1) {}

At the end of the loop function to stop it exiting.

This version uses a pushbutton switch to activate the blinking schedule.
If you don’t have a pushbutton then just use a piece of wire connected to “Pin2” (D2) and tick that to “Gnd” to get it going.

//   10,20,30
//   now with pb activation
//

int reps;
const byte activate = 2;
byte flag = 0;

void setup()
{
  pinMode(13,OUTPUT);
  pinMode(activate,INPUT_PULLUP);
}

void loop()
{
  flag = digitalRead(activate);
  if (flag == 0)
  {
    for(reps = 0; reps < 80; reps ++)
    {
      blinkit();
    }
    delay(2000);
  
    for(reps = 0; reps < 160; reps ++)
    {
      blinkit();
    }
    delay(2000);
  
    for(reps = 0; reps < 240; reps ++)
    {
      blinkit();
    }  
    delay(2000);
  }
}

void blinkit()
{
  digitalWrite(13,HIGH);
  delay(65);
  digitalWrite(13,LOW);
  delay(60);
}

pushbutton starts 3 times through the 10/20/30

//   10,20,30
//   now with pb activation
//   runs through the schedule 3 times
//

int reps;
const byte activate = 2;
byte flag = 0;
byte timesthru;

void setup()
{
  pinMode(13,OUTPUT);
  pinMode(activate,INPUT_PULLUP);
}

void loop()
{
  flag = digitalRead(activate);
  if (flag == 0)
  for(timesthru = 0; timesthru < 3; timesthru ++)
  {
    {
      for(reps = 0; reps < 80; reps ++)
      {
        blinkit();
      }
      delay(2000);
 
      for(reps = 0; reps < 160; reps ++)
      {
        blinkit();
      }
      delay(2000);
 
      for(reps = 0; reps < 240; reps ++)
      {
        blinkit();
      } 
      delay(2000);
    }
  }
}

void blinkit()
{
  digitalWrite(13,HIGH);
  delay(65);
  digitalWrite(13,LOW);
  delay(60);
}