"not declared in this scope"

So, I am working on an LED project for a friend. I have a 6 position switch that is going to control the led "flash" patters. (Just explaining the gaggle of as-of-yet useless code in the beginning.

void setup() {
  // Begin setting Digital pinModes
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  pinMode(2, INPUT);
  pinMode(3, OUTPUT);
  pinMode(4, INPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, INPUT);
  pinMode(13, INPUT);
  // Set analog ins
  int leftPot = analogRead(A0);
  int rightPot = analogRead(A1);
  int speaker = analogRead(A2);
  //Name LED Pins
  int led1 = 3;
  int led2 = 5;
  int led3 = 6;
  int led4 = 7;
  int led5 = 8;
  int led6 = 9;
  int led7 = 10;
  int led8 = 11;
  
  
}
void loop() {
  digitalWrite(led1, HIGH);
  delay(500);
  digitalWrite(led1, LOW);
  delay(500);
}

And I am getting this error: Mega_Project.cpp: In function 'void loop()': Mega_Project:33: error: 'led1' was not declared in this scope

Is there an issue with "int led1 = 3;"?

The only issue is that you put it inside setup() so only setup() knows about it. If you want it to be global you should move it outside the functions.

Wow. lol.. yep. That was the issue. Thank you very much.

hey, this what happen! Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\sys\Documents\Arduino\sketch_oct25a\sketch_oct25a.ino: In function 'void setup()':

sketch_oct25a:8: error: 'LED1' was not declared in this scope

pinMode(LED1, OUTPUT);

^

sketch_oct25a:9: error: 'LED2' was not declared in this scope

pinMode(LED2, OUTPUT);

^

sketch_oct25a:10: error: 'LED3' was not declared in this scope

pinMode(LED3, OUTPUT);

^

C:\Users\sys\Documents\Arduino\sketch_oct25a\sketch_oct25a.ino: In function 'void loop()':

sketch_oct25a:17: error: 'LED1' was not declared in this scope

digitalWrite(LED1, HIGH); //turn on LED1

^

sketch_oct25a:21: error: 'LED2' was not declared in this scope

digitalWrite(LED2, HIGH);//turn on LED2

^

sketch_oct25a:25: error: 'LED3' was not declared in this scope

digitalWrite(LED3, HIGH);// turn on LED3

^

exit status 1 'LED1' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

pinMode(LED1, OUTPUT);

int led1 = 3; // is in your posted sketch

"led1" and "LED1" are not the same. Leo..