I try to learning Arduino
and in a learning video from Poul McWhorter i have this
code :
void loop() {
Serial.println("How Many Times Do You Want the Red LED to blink?"); //Prompt User for Input
while(Serial.available()==0) {}
numRedBlinks=Serial.parseInt(); //Read the data the user has input
Serial.print("antal rød = ");
Serial.println(numRedBlinks);
Serial.println("How Many Times Do You Want the yellow LED to blink?"); //Prompt User for Input
while(Serial.available()==0) {} // Wait for User to Input Data
numYellowBlinks=Serial.parseInt(); //Read the data the user has input
Serial.println(redMessage);
for (int j=1; j<=numRedBlinks; j=j+1) { // Start our for loop
Serial.print(" You are on Blink #: ");
Serial.println(j);
digitalWrite(redLEDPin,HIGH); //Turn red LED on
delay(redOnTime); //Leave on for redOnTime
digitalWrite(redLEDPin,LOW); //Turn red LED off
delay(redOffTime); //Leave off for redOffTim
Serial.println(" ");
Serial.println(yellowMessage);
for (int j=1; j<=numYellowBlinks; j=j+1) { // Start our for loop
Serial.print(" You are on Blink #: ");
Serial.println(j);
digitalWrite(yellowLEDPin,HIGH); //Turn yellow LED on
delay(yellowOnTime); //Leave on for yellowOnTime
digitalWrite(yellowLEDPin,LOW); //Turn yellow LED off
delay(yellowOffTime); //Leave off for yellowOffTime
}
Serial.println(" ");
The program never stop by the second While, it continus and assume that numYellowBlinks is zero
does anyone have a good answer before i lost my faith in Arduino.
Kent Orthmann