expected unqualified-id before numeric constant

Hey guys so I just got the Arduino uno starter kit for Christmas and I am still trying to figure out how to use it and code (have not had anytime to sit down and do any projects). I am stuck on project number 2 in the project book that comes with it. The problem is in the code. Can you guy help me out? Here is the code

1 int switchstate=0 2 void setup(){ 3 pinmode(3,OUTPUT; 4 pinmode(4,OUTPUT); 5 pinmode(5,OUTPUT); 6 pinmode(6,OUTPUT); 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 beginning of the loop

Now I keep getting the "expected unqualified-id before numeric constant" error message for number 8. I tried searching around on google to see if anyone has had any similar issues but could not find anything. What am I doing wrong?

missing semicolon at the end of

int switchstate=0

missing close paren here:


It's pinMode(), not pinmode(). C is case sensitive.

Missing semicolons or closing parens/braces/brackets/quotes often give less-than-helpful errors. Syntax highlighting makes it clear when there are mismatched quotes, and ctrl+T to format the sketch is good for catching mismatched braces; I don't recall if it makes mismatched parens obvious.

Thank you for catching my simple mistakes, I corrected those mistakes but I am still getting an error message. Let me post the new code

int switchstate = 0; void setup() { pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); } void loop() { switchState = digitalRead(2); // this is a comment if (switchState == LOW) { // the button is not pressed digitalWrite(3, HIGH); //green LED digitalWrite(4, LOW); //red LED digitalWrite(5, LOW); //red LED } else { // the button is pressed digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH); delay(250); // wait for a quarter second // toggle the LEDs digitalWrite(4, HIGH); digitalWrite(5, LOW); delay(250); //wait for a quarter second } } //go back to beginning of the loop

I keep getting two error messages at the "switchState = digitalRead(2);" and "if (switchState == LOW) {" part. The error message is that "switchState was not declared in this scope"

DrAzzy: C is case sensitive.

switchState != switchstate

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :)