Arduino error: expected unqualified-id before 'else'

1k views Asked by At

The Arduino console gives me: expected unqualified-id before 'else' What's wrong with my code?

Here's the code http://pastebin.com/esU80naM

If you can, also give me repaired code on pastebin

Thanks!

Problem is with line 164 in pastebin else if (digitalRead(c3)==LOW){

1

There are 1 answers

0
Paul R On

It's a simple and obvious typo and the error message already tells you everything you need to know. Change:

if(digitalRead(c0)==LOW);

to:

if(digitalRead(c0)==LOW){

Note that the error reported by the compiler relates to an else clause without a preceding if, so you need to work backwards from the reported error to find the source of the problem. This is quite common and you will no doubt encounter similar problems again in the future.