Macro names how to fix???

Hello everyone I am in a bit of a bind here. I am EXTREMELY new to coding and Arduino. I bought this recently for a school project and the instructions have this code
// LED light dance

#define soundpin 8 // reads the power from the light sensor from Analog input 0
#define LED1 3 // 4 Leds LED's on Digital output pins 3,4,5,6
#define LED2 4
#define LED3 5
#define LED4 6

int sound;

void setup()
{
// initialize the serial communications:
Serial.begin(9600);

// Provide power by using the analog inputs as normal digital pins.
pinMode(soundpin, INPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
}
void loop()
{
sound=analogRead(soundpin); // this samples the sound constantly
if((sound)>200)
{
digitalWrite(LED1,HIGH); // set the LEDs on
digitalWrite(LED2,HIGH);
digitalWrite(LED3,HIGH);
digitalWrite(LED4,HIGH);
}
else if((sound)>150)
{
digitalWrite(LED1,HIGH); // set the LED on
digitalWrite(LED2,HIGH);
digitalWrite(LED3,HIGH);
digitalWrite(LED4,LOW); // set the LED off
}
else if(sound>100)
{
digitalWrite(LED1,HIGH); // set the LED on
digitalWrite(LED2,HIGH);
digitalWrite(LED3,LOW); // set the LED off
digitalWrite(LED4,LOW);
}
else if(sound>50)
{
digitalWrite(LED1,HIGH); // set the LED on
digitalWrite(LED2,LOW); // set the LED off
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
}
else
{
digitalWrite(LED1,LOW); // set the LEDs off
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
}

Serial.println(soundpin); //output for serial monitor

delay(25); // And a shot delay
}

But when I use it, it says macro names must be identifiers
PLEASE HELP

When I compile it I get

Sketch uses 3,110 bytes (9%) of program storage space. Maximum is 32,256 bytes.
Global variables use 186 bytes (9%) of dynamic memory, leaving 1,862 bytes for local variables. Maximum is 2,048 bytes.

Windows 7
IDE 1.5.6-r2

Incidentally, what is this supposed to do

  Serial.println(soundpin);              //output for serial monitor

Here is a link to my project if that helps
http://www.hobbyist.co.nz/?q=making-led-lights-dance-to-your-music

wesleyggg:
Here is a link to my project if that helps
http://www.hobbyist.co.nz/?q=making-led-lights-dance-to-your-music

No help at all I am afraid.

What version of the IDE are you using and which OS ?

Not surprisingly, when I run the program what I get in the Serial monitor is repeated printing of the number 8.

and what is this all about ?

#define soundpin 8               //  reads the power from the light sensor from Analog input 0

UKHeliBob:
and what is this all about ?

#define soundpin 8               //  reads the power from the light sensor from Analog input 0

I think he said, he’s not the author.

@wesleyggg,

your code compiles just fine…

Perhaps you have some extra/missing/bad characters in your copied text… check to see that it is exactly as it should be.

I have copied and paste it multiple times and the same error comes about. Is it perhaps the version I am using? If so how would I check that...

wesleyggg:
I have copied and paste it multiple times and the same error comes about. Is it perhaps the version I am using? If so how would I check that...

you could try to delete the IDE you are using and download/install the latest version

wesleyggg:
I have copied and paste it multiple times and the same error comes about. Is it perhaps the version I am using? If so how would I check that...

What version would that be? You've kind of left that information out.

wesleyggg:
I have copied and paste it multiple times and the same error comes about. Is it perhaps the version I am using? If so how would I check that…

The version of the IDE is marked at the top of the IDE window.

Click “copy error message” when the compile fails, and paste the output here (use code tags, the </> button in top left of forum reply form to make it easier for us to read the code).

Delta_G:
What version would that be? You’ve kind of left that information out.

As I read his post, he’s asking how to check which version he’s using…

Copy and paste the exact error.

I am currently reinstalling the IDE then will post error if it occurs again

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

sketch_may22a:3: error: macro names must be identifiers

#define soundpin 8         //  reads the power from the light sensor from Analog input 0

^

sketch_may22a:4: error: macro names must be identifiers

#define LED1 3           //  4 Leds LED's on Digital output pins 3,4,5,6

^

sketch_may22a:5: error: macro names must be identifiers

#define LED2 4

^

exit status 1
macro names must be identifiers

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

There are unprintable characters in your code. Delete the entire code and copy the one from your first post

Copy the sketch code to a text file to lose any crap characters.
Copy the text into the IDE editor.

.

How would I do that?

Open your code. Put your cursor on the screen. Press control-A then control-C. Come here and make a new post and press the </> button to get code tags. Put the cursor between them. Press control-V. Post it. Select the code in the code box and press control-C again. Go back to the IDE with your code. Press control-A and then control-V. Compile your code.

Actually, you can get a clean copy from reply #3 by clicking on Code:select and then pasting into your IDE. :slight_smile:

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 2358 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 188 bytes (9%) of dynamic memory, leaving 1860 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\.\COM1": The system cannot find the file specified.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I think I fixed the code but now this appears??

Sure you got the right port selected in the tools menu?

It says done uploading so I believe I am done. Thank you all for your help! I wasn't sure how active/friendly you all were but needless to say i'll come back one day!!!