detecting a rising edge suing arduino

Hello Arduino team :slight_smile:
i'm new user for Arduino, i use it to generate a ten pulse train. I need to generate the train when i press a push-button .. the problem is that it continues restarting the pulse (while the push-button is pressed) even if the first train is not yet finished !!
then , my two questiond are :
1- how can i make the condition to start the train generation, a rising edge and not a pressed button ?

2- do I have to write the following instructions ten times or there is an idea to execute the void loop ten times and stop ?? -----

digitalWrite(led1, HIGH);
delayMicroseconds (1);
digitalWrite(led1, LOW);
delayMicroseconds (1);

to better understand this is my programe

const int bouton = 2; //le bouton est connecté à la broche 2 de la carte Adruino
const int led1 = 8; //la LED à la broche 13

int etatBouton; //variable qui enregistre l'état du bouton

void setup()
{
pinMode(led1, OUTPUT); //la led est une sortie
pinMode(bouton, INPUT); //le bouton est une entrée
etatBouton = LOW; //on initialise l'état du bouton comme "relaché"
}

void loop()
{
etatBouton = digitalRead(bouton); //Rappel : bouton = 2

if(etatBouton == HIGH) //test si le bouton a un niveau logique HAUT
{
// i write the follwing instructions ten times
digitalWrite(led1, HIGH);
delayMicroseconds (1);
digitalWrite(led1, LOW);
delayMicroseconds (1);

}
}

If the pin is now HIGH, and the last time you looked it was LOW, then you've found a rising edge.
Yes, you can write "for" loops to repeat the same code multiple times.

Thank you very much :slight_smile: it works
i thought that is more complicated