What have i done wrong?

int switchstate = 0;

void setup() { pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT);

pinMode(2,INPUT);

}

void loop() {

switchstate = digitalRead(2);

if(switchstate == LOW) digitalWrite(3,HIGH); digitalWrite(4,LOW); digitalWrite(5,LOW); }

else { digitalWrite(3,LOW); digitalWrite(4,LOW); digitalWrite(5,HIGH);

delay(250); digitalWrite(4,HIGH); digitalWrite(LOW);

delay(250) } }

Arduino: 1.7.6 (Mac OS X), Board: "Arduino Uno"

sketch_pro2.ino:25:1: error: expected unqualified-id before 'else' sketch_pro2.ino:36:1: error: expected declaration before '}' token Error compiling.

 if(switchstate == LOW)

You missed a { after that.

You also missed the code tags

thanks ; :) code tag?

[code][/code]

You can have those - they're a spare pair I had lying around

okkk, hmm, it still doesn't accept my written version, even though now it is identical to the example version ?

Nope, didn't understand that at all. Please feel free to post your revised code.

int switchstate = 0;

void setup() {

pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT);

pinMode(2, INPUT); }

void loop() {

switchstate = digitalRead(2);

if(switchstate == LOW){ digitalWrite(3, HIGH); digitalWrite(4, LOW); digitalWrite(5, LOW); }

else { digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH);

delay(250); digitalWrite(4, HIGH); digitalWrite(5, LOW);

delay(250); } }

Again, the code tags are noticeable by their absence, but otherwise things look OK to me.

sorry yeh, its working now, thanks