Go Down

Topic: project2: ERROR: expected unqualified-id before numeric constant (Read 61 times) previous topic - next topic

ojunyent

Hello, today is my first day... i supose it's easy but I can't find the error
here may code, and the error is in number 8 and the message is: "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 //funcionarà?
11 if (switchState == LOW) {
12 // el boto no esta apretat
13 digitalWrite(3, HIGH); //verd
14 digitalWrite(4, LOW); //vermell
15 digitalWrite(5, LOW); //vermell
16 }
17 else { //el boto esta apretat
  18  digitalWrite(3, LOW);
  19 digitalWrite(4, LOW);
  20 digitalWrite(5, HIGH);
21 delay(250); // espera un quart de segon
22 //toggle the leds
23 digitalWrite(4, HIGH);
24 digitalWrite(5, LOW);
25 delay(250); // espera un quart de segon
26 }
27 } // torna al principi del loop

thanks a lot!

ojunyent

ok, the think is that I've wrote the numbers...

as the book shows the numbers 1, 2, 3, for each line... I wrote them too...

Thanks for all the answers! :o

Go Up