macro names must be identifiers

The last thing you did is where you should start looking.

larryd If I could remember that, I'd know where I left the sodding keys/glasses/credit card/screwdriver 5-minutes ago

When i compiled it it shows macro names must be identifiers what to do

sopac12:

define SENSE AO

int voidsetup(): { pinmode (SENSE,INPUT) pinmide (2,OUTPUT) ;

pinmode (LED_BUILTIN,OUTPUT) ; } voidloop ()

{ if (digital read (SENSE)) { digitalwrite (LED_BUILTIN,LOW) ; pinmode (2,LOW) } else { digitalwrite (LED_BUILTIN,HIGH); pinmode (2,HIGH); } }

Do you have a c/c++ language reference that shows "# define" as valid pre-processor syntax? I sure don't....

Regards, Ray L.

RayLivingston: Do you have a c/c++ language reference that shows "# define" as valid pre-processor syntax? I sure don't....

Then you should get a proper reference.

The standards say

The only white-space characters that shall appear between preprocessing tokens within a preprocessing directive (from just after the introducing # preprocessing token through just before the terminating new-line character) are space and horizontal-tab (including spaces that have replaced comments or possibly other white-space characters in translation phase 3).

In other words, "#define" and "# define" are equally valid.