Press key to stop execution on specific point

-In this program, LED turns on and gradually illuminates (connection on PWMpin=9;).
-For each function FOR, the number of itineration is counted on Serial Monitor.
-On i=50, Serial monitor needs to wait until a key 's' is activated.

##Code:[ // Fait varier le flux lumineux d'une DEL en utilisant une sortie PWM
int PWMpin = 9; // Sélectionne la DEL branchée sur la sortie PWM no. 9 de la carte Arduino Uno
char bouton =0; //Déclaration du caractere initial de la valeur NULL

void setup()
{
Serial.begin(115200); //Configure le port série pour 115200 baud
}

void loop(){ // Répetition des commandes a executer

for (int i=0; i <= 25; i++){ // Compte du variable 0 à 25 en incrimentation
analogWrite(PWMpin, i); // Envoie le courant à la broche entre 5V et 0V
delay(10); // Attends 100 ms avant de boucler de nouveau
Serial.println(i); // Affiche sur la console sérielle la valeur de la variable "i" dans la première boucle
}

do{ // A faire jusqu à ce que le bouton ne soit =115DEC tourne en rond
bouton=Serial.read(); // Lecture du caractere envoye
}

while(bouton!=115); // Lorsque le bouton n'st pas= à ('s',DEC) soit 115 en DEC

if (bouton ==115){
Serial.print("charState="); // Affiche charState sur le moniteur de série
Serial.print(bouton); // Affiche le bouton appuye sur le moniteur de série
for (int i=50; i<= 75; i++){ // Incrimentation du variable i de 50 a 75
analogWrite(PWMpin, i); // Envoie le courant à la broche entre 5V et 0V
delay(10); // Attends 10 ms avant de boucler de nouveau
Serial.print(i); // Affiche sur la console sérielle la valeur de la variable "i" dans la troisième boucle

}
for (int i=100; i <= 255; i++){ // Compte du variable 0 à 25 en incrimentation
analogWrite(PWMpin, i); //Envoie le courant à la broche entre 5V et 0V
delay(10); //Attends 10 ms avant de boucler de nouveau
Serial.println(i); //Affiche sur la console sérielle la valeur de la variable "i" dans la deuxième boucle
}
}
}

]

This is my final version....

On i=50, I need to stop my program by adding a key

A physical switch?
A serial keystroke?
Do you plan on restarting?
(Please use code tags)

Look at the "blink without delay" example.

Also format your code before posting.

Mark

It<s a key stroke, an (char MyChar='s'; ) I suppose it should be something like that,really not sure

AWOL:

On i=50, I need to stop my program by adding a key

A physical switch?
A serial keystroke?
Do you plan on restarting?
(Please use code tags)

No, just push a key and stop Serial Monitor running.

No, just push a key and stop Serial Monitor running.

If you want to stop the Serial Monitor, just close it. That won't have any affect on the Arduino, though.

If you want the Arduino to stop, use a while loop, in which you check the state of a switch. Break when the switch is pressed.

Is it possible to make Arduino wait until I decide to press a specific character / or read specific byte. How can I do that?

Read this before posting a programming question

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.

Is it possible to make Arduino wait until I decide to press a specific character / or read specific byte. How can I do that?

You read a character, and if you don't get it, you keep reading until you do.