A problem in a code

Hello everyone I wrote this code and I think there's a problem it says "expected initializer before numeric constant". This code uses force sensor as input data and after 50 presses on it it turn on the light.

int fsrPin = 0;     // the FSR and 10K pulldown are connected to a0
int fsrReading;     // the analog reading from the FSR resistor divider
int led 13
 
void setup(void) {
  PinMode (led, OUTPUT);
  Serial.begin(9600);   
}
 
void loop(void) {
  fsrReading = analogRead(fsrPin);  
 
  Serial.print("Analog reading = ");
  Serial.print(fsrReading);     // print the raw analog reading
 Counter=0;
  if (fsrReading >0) {
Counter=Counter+1;
if (x=50){
 digitalWrite (LED,HIGH);
}
else{
 digitalWrite (LED,LOW);
}
  else{
}
  delay(1000);
}


Oops

Also oops

And again

Wowser.

got it

how to fix this:

int led 13

didn't understand
and this

PinMode (led, OUTPUT);

With one of these '=' and one of these ';'

With a lower-case p

1 Like

There is a very high chance for this to be true.

Just a few problems to fix:

const int led = 13;

pinMode(led, OUTPUT);

static int Counter = 0;

if (Counter == 50) {

You called it 'led', not 'LED'.

Does nothing and doesn't fit there. Leave it out.

Missing a '}' at the end.

1 Like

The last two points

  else{
}

should I delete it?

  delay(1000);
}

but there's '}' by the end should I add one more?

If you don't, you will get an error.

If you don't, you will get an error.

1 Like