Arduino Leonardo Not Accepting Declarations

Hello Everybody!

My Arduino program is now allowing me to declare any variables, it just ignores them in the setup. Does anyone have a solution for this? I'm using version 1.6.4 and have it set to a Leonardo board.

void setup() {

pinMode(A0, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
int value;
}

void loop() {

Serial.read(value);
delay(50);
Serial.print(value);
delay(500);
analogWrite(13, value);
delay(500);
analogWrite(value++);
delay(50);

}

Does anyone have a solution for this?

Declare them properly. Declaring a variable in one function, and using it in another has never worked for anyone.

I R LEARNING! Thank you. :slight_smile:

int value;

void setup() {

pinMode(A0, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);

}

void loop() {

Serial.read();
delay(50);
Serial.print(value);
delay(500);

if(value < 255){
value = (value + 1);
}

delay(50);
analogRead(A0);

}