exit status 1, redefinition of 'void setup()'

Dear all, I’m very new with using Arduino and its programming and I’m currently trying to play with a potentiometer. However, something is wrong in my program and I can’t find what…

void setup() {
int sensorPin = A0;
int ledPin = 13;
pinMode(ledPin, OUTPUT);
}

void loop() {
int sensorValue;
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}

I already tried to get the int before the void setup(), but then I get also an exit status 1, in this case redefinition of ‘int…’

What am I overlooking ?
Thank you in advance for the answer !

sensorPin's scope is limited to setup()

Please remember to use code tags when posting code

const byte sensorPin = A0;
const byte ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
}


void loop() {
  int sensorValue = analogRead(sensorPin);    
  digitalWrite(ledPin, HIGH); 
  delay(sensorValue); 
  digitalWrite(ledPin, LOW); 
  delay(sensorValue); 
}

Uncompiled, untested

Thanks for the reply, but this doensn't work either. The error I receive now is:

exit status 1 conflicting declaration 'const byte sensorPin'

The error I receive now is:

Post YOUR code, exactly as you are trying to compile.

Sorry, I forgot to recopy the new code...

const byte sensorPin = A0;
const byte ledPin = 13;

void setup() {
pinMode(ledPin, OUTPUT);
}


void loop() {
  int sensorValue;
  sensorValue = analogRead(sensorPin);    
  digitalWrite(ledPin, HIGH); 
  delay(sensorValue); 
  digitalWrite(ledPin, LOW); 
  delay(sensorValue); 
}

When I compile that code, I get:

Sketch uses 1,136 bytes (3%) of program storage space. Maximum is 32,256 bytes. Global variables use 11 bytes (0%) of dynamic memory, leaving 2,037 bytes for local variables. Maximum is 2,048 bytes.

So, it appears that you are doing something wrong.

Sorry, I forgot to recopy the new code...

Have you got more than one tab open in the IDE ?

Thank you UKHeliBob !!! That was the problem. Now it works. Didn't know this could be a problem.

The files open on all tabs within the IDE are included when the main program is compiled. This is deliberate and can be used to advantage to separate functions into separate files, for instance, but it does mean that functions on different tabs must have different names, or at least that is the simplest way to think of it.