something wrong with this code for LEDs?

Function required: press pushbutton – Turn on 3 LEDs on, flash 800us, delay 12000us, turn on again, 3 times (cycles) totally.

Seems something wrong with following code, please check for me, thank you very much!!

int pushbuttonpin=7; //Pin for momentary push button switch
int val=0;
const int redLED = 4;
const int yelloLED = 5;
const int greenLED = 6;

void setup()
{
Serial.begin(9600);
pinMode(pushbuttonpin, INPUT);     //Declare push button switch pin as input
pinMode(redLED, OUTPUT);
pinMode(yelloLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}

void loop()
{
int i; 
 val = digitalRead(pushbuttonpin);   //Read push button switch pin status
   if (val == HIGH)
  for (i = 0; i<5; i++) // 5 cycles   
{
flash(redLED, 800);
flash(yelloLED, 800);
flash(greenLED, 800);
}
delay(12000);
}

void flash(int pin, int wait)
{
digitalWrite(pin, HIGH);
delay(wait);
digitalWrite(pin, LOW);
delay(wait);
}

We know not "Seems".

What do you say is not working.

Don't use delay. .

I uploaded, it’s OK, but did not turn on LEDs at all.

Please show us a schematic diagram.

So, do you have pull-down resistor on that pushbutton?

Yes, one pull-down resistor on that pushbutton. (I don't have schematic diagram yet. )

Your description says us, wich I assume is µs (microseconds). In code, timing is done with delay(), which take milliseconds as argument.

You blink LEDs one at a time for 800 milliseconds (0,8 seconds), and then repeat that pattern 4 more times.

Do you want all your LEDs on at the same time? Is it 800 ms or 800 µs you want?

Richard905: I uploaded, it's OK, but did not turn on LEDs at all.

Does it turn on the LEDs if you hold down the button for more than 12 seconds?

Seriously - try it and see. Time yourself - hold down the button for a good 15 seconds and see if the LEDs light.

I bet they will. And it won't be exactly at the 12 second mark, it will be some time within 12 seconds. When you work out why it is doing that, you will headsmack the keyboard.