verify or load error message

Hi All,

I am new to Ardino and any help would be appreciated,

I have printed and copied to the letter this program fromtoptechboy lesson6 to the letter and duble checked many times.

the highlighted part in red is: for (int j=1; j<=numRedBlinks; j=j+1 { //start out for loop
the error message on the screen is: "numRedBlinks" was not declared in this scope

Thank you in advance
craig.l

Always show us your current compete sketch.
Use CTRL T to format the sketch.
Please use code tags. Use the </> icon in the posting menu.

[code] Paste sketch here. [/code]

.

You did not define it, or you defined it in the wrong place.

The error is in line 35 of the complete code you posted in code tags as described in the thread

"Read this before posting a programming question".

Wait... you did not post the complete code and did not even use code tags for the useless snippet you posted.

Could it be that you did not read the sticky thread I mentioned?
Or is there any other reason to ignore its content?

Compiles without error for me:

int redLEDPin = 9; //Declare redLEDPin an int, and set to pin 9
int yellowLEDPin = 10; //Declare yellowLEDPin an int, and set to pin 10
int redOnTime = 250; //Declare redOnTime an int, and set to 250 mseconds
int redOffTime = 250; //Declare redOffTime an int, and set to 250
int yellowOnTime = 250; //Declare yellowOnTime an int, and set to 250
int yellowOffTime = 250; //Declare yellowOffTime an int, and set to 250
int numYellowBlinks = 5; //Number of times to blink yellow LED
int numRedBlinks = 5; //Number of times to blink red LED
String redMessage = "The Red LED is Blinking"; //Declaring a String Variable
String yellowMessage = "The Yellow LED is Blinking"; //Declaring a String Variable

void setup() {
  Serial.begin(115200);        // Turn on the Serial Port
  pinMode(redLEDPin, OUTPUT);  // Tell Arduino that redLEDPin is an output pin
  pinMode(yellowLEDPin, OUTPUT);  //Tell Arduino that yellowLEDPin is an output pin
}

void loop() {

  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 redOffTime
  }
  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(" ");
}

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile: