IfstatementConditional

just got my arduino up and running. no much epxerience in programming.

i am trying to get the example IfstatementConditional to work but i get the folowing error message.

"In function void setup()
error: 'LED' was not declared in this scope"

/*
Conditionals - If statement

created 17 Jan 2009
by Tom Igoe

*/

// These constants won't change:
const int analogPin = 0; // pin that the sensor is attached to
const int ledPin = 13; // pin that the LED is attached to
const int threshold = 400; // an arbitrary threshold level that's in the range of the analog input

void setup() {
// initialize the LED pin as an output:
pinMode(LED, OUTPUT);
// initialize serial communications:
Serial.begin(9600);
}

void loop() {
// read the value of the potentiometer:
int analogValue = analogRead(analogPin);

// if the analog value is high enough, turn on the LED:
if (analogValue > threshold) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin,LOW);
}

// print the analog value:
Serial.println(analogValue, DEC);

You haven't defined what LED is. But i think you mean that line to look like this anyway.

pinMode(ledPin, OUTPUT);

Its as it says " 'LED' was not declared in this scope" perhaps if you changed

pinMode(LED, OUTPUT);

to

pinMode(ledPin, OUTPUT);

it would work.

Great minds think alike..... :wink:

Don't know about that but i sometime mess up and get something right. LOL. ;D

cheers guys. im on my way :smiley: