Problem with Arduino Starter Kit

Hello

I started with the Spaceship Interface and wrote following program:

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 // this is a comment

11 if (switchState == LOW) {
12 // the button is not pressed

13 digitalWrite(3, HIGH); // green LED
14 digitalWrite(4, LOW); // red LED
15 digitalWrite(5, LOW); // red LED
16 }
17 else { // the button is pressed
18 digitalWrite(3, LOW);
19 digitalWrite(4, LOW);
20 digitalWrite(5, HIGH);

21 delay(250); // wait for a quarter second
22 // toggle the LEDs
23 digitalWrite(4, HIGH);
24 digitalWrite(5, LOW);
25 delay(250); // wait for a quarter second

26 }
27 } // go back to the beginning of the loop

When I try to run the program I get an error:

sketch_dec21a.ino:2:1: error: expected unqualified-id before numeric constant
sketch_dec21a.ino:3:1: error: expected unqualified-id before numeric constant
sketch_dec21a.ino:1:1: error: expected unqualified-id before numeric constant
sketch_dec21a.ino:5:1: error: expected unqualified-id before numeric constant
sketch_dec21a.ino:11:1: error: expected unqualified-id before numeric constant
Fout bij het compileren.

Can someone help me please?

Thank you!

There are no line numbers in a c program. ROLF.

Mark

Thank you very much! It runs now! I'm learning :grinning: :grinning:

1 I totally missed that
2 until I saw Holmes's answer
3 LOL