When compiling

Here's my code:

int buttonPin = 10;
int buttonState = 0;
int photoPin = 0;
int photoValue = 0;
int ledPin = 11;
void setup ()
{
pinMode (buttonPin, INPUT);
pinMode (photoPin, INPUT);
pinMode (ledPin, OUTPUT);
}
void loop ()
{
buttonState = digitalRead (buttonPin);
photoValue = analogRead (photoPin);
if (buttonState == HIGH)
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
else if (photoValue <= 10)
{
digitalWrite(ledPin, HIGH);
delay(750);
digitalWrite(ledPin, LOW);
delay(750);
}
else () // error: expected primary-expression before ')' token PROBLEM =(
{
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
}
And for me shows two problems: :0 :0 =( =(

  1. error: expected primary-expression before ')' token
  2. error: expected `;' before '{' token

Please help!!!! Thanks. :slight_smile:

else ()

"else" is not a function.

else () // error: expected primary-expression before ')' token PROBLEMĀ  smiley-cry

Why are there parentheses on this line? There should not be.

elseĀ  // no () like the above else

Thanks for everyone. I am ,,green" on Arduino, so I do stupid mistakes :smiley:

And here is another error

int photoPin = 0; use a byte not an int and its not 0 its A0 and you do not set analog pins as inputs.

Mark

and its not 0 its A0

0 is perfectly fine. If you supply A0 as input to analogRead(), it maps it to 0.

and you do not need to set analog pins as inputs.

Generally, doing so accomplishes nothing, but it is not harmful.