" expected unqualified-id before numeric constant"....Need help

#define sensorpin 0
#define pause 3000
#define buzzer 12

int buzzer;
int val;

void setup() {
  pinMode(buzzer, OUTPUT);
}

void loop() {
  val = analogRead(sensorpin);
  if (val<=450) {
    digitalWrite(buzzer, HIGH);
  }
  else {
    digitalWrite(buzzer, LOW);
  }
  delay(pause);
}

i get this error :’( :’( "expected unqualified-id before numeric constant
"line 4.and i have no idea what to do for this … :slightly_frowning_face: someone please help(try verifying the code with your IDE) :cold_sweat:

Think about what the code will look like when the pre-processor substitutes 12 for buzzer

ie

int 12;

remove

int buzzer;

You define buzzer as 12, and use it later as a pin number, but you also declare it an int just after the define.

Lose this line, or replace buzzer with another name if you think you’ll need it:

int buzzer;

:stuck_out_tongue: :stuck_out_tongue: uh ohh..!! :grin: :stuck_out_tongue: thanks for help ukhelibob

Identical threads merged.