2:1: error: expected unqualified-id before numeric constant

1 int switchState = 0;
 
 2 void setup(){
 3   pinMode(3,OUTPUT);
 4   pinMode(4,OUTPUT);
 5   pinMode(5,OUTPUT);
 6   pinMode(2,INPUT);
 7 }
 
 8 void loop(){
 9   switchState = digitalRead(2);
 10//Lee el voltaje del pin 2
 11    if (switchState == LOW){
 12 //El boton no esta pulsado
 13       digitalWrite(3,HIGH);//LED verde
 14       digitalWrite(4,LOW);//LED rojo
 15       digitalWrite(5,LOW);//LED rojo
 16  }
 17    else { //El boton esta pulsado
 18      digitalWrite(3,LOW);
 19      digitalWrite(4,LOW);
 20      digitalWrite(5,HIGH);
 21      delay(250);//Espera 250 milisegundos
 22      digitalWrite(4,HIGH);
 23      digitalWrite(5,LOW);
 24      delay (250);//Vuelve a esperar otro cuarto de segundo
 
 25    }
 27  } //Vuelve al inicio del bucle

What's this error and how I can solve then?

C doesn't use line numbers.
Lose them.

thanks! that's right! :stuck_out_tongue:

and this faild?

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00

Which Arduino board are you using ?
Which board is selected in the IDE ?
Which port are you using ?
Does the port appear in the list of available ports when you plug in the Arduino and disappear when you unplug it ?

vinnycss:
and this faild?

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00

From your other thread:

vinnycss:
My teacher said that I don't need a script because I don't have a Arduino to test it...

Do you have your Arduino yet?

yes, i have a Arduino Uno board