Just got my arduino and trying to attach a photo-resistor to control a LED. The code is from the Arduino-book:
#define LED 13
int value = 0;
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
val = analogRead(0);
digitalWrite(13, HIHG);
delay(val);
digitalWrite(13, LOW);
delay(val);
}
I get this error when compiling:
In function 'void loop()':
error: 'val' was not declared in this scope
Where did I go wrong?