Hi
I'm a noob. Can anyone please explain why I get a "'ranum' was not declared in this scope" error in this script? I was obviously using Arduino.
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(10, OUTPUT);
pinMode(09, OUTPUT);
double ranum = rand()%11;
}
void loop()
{
if (ranum==0){
digitalWrite(13, LOW); // Turn on the LED
digitalWrite(12, LOW);
digitalWrite(10, LOW);
digitalWrite(09, LOW);
}
else if (ranum==1){
digitalWrite(13, HIGH); // Turn on the LED
digitalWrite(12, LOW);
digitalWrite(10, LOW);
digitalWrite(09, LOW);
}
else {
digitalWrite(13, LOW); // Turn on the LED
digitalWrite(12, HIGH);
digitalWrite(10, LOW);
digitalWrite(09, LOW);
}
}