need some help in this programme i cant seem to compile it..
const int Redled = 12; // the number of LED pin
const int Greenled = 13; // the number of LED pin
const int buttonPin = 2; // the number of the pushbutton pin
void setup() {
pinMode(Redled , OUTPUT); // initialize LED pin 12 as an output
pinMode(Greenled, OUTPUT); // initialize LED pin 13 as an output
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input
pinMode(Redled, OUTPUT); // initialize the RedlED pin as an output
pinMode(Greenled, OUTPUT); // initialize the GreenlED pin as an output
}
void loop() {
byte buttonState = digitalRead(buttonPin); // read the state of the pushbutton value
if
{
(buttonState == HIGH); // if it is, the buttonState is HIGH
// check if the pushbutton is pressed
digitalWrite(Redled, HIGH); // turn the RedLED on (HIGH is the voltage level)
digitalWrite(Redled, HIGH); // turn the RedLED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(Greenled, LOW); // turn the GreenLED off by making the voltage LOW
delay(500); // wait for a second
digitalWrite(Greenled, LOW); // turn the GreenLED off by making the voltage LOW
delay(500); // wait for a second
}
{
else
// turn LED off:
digitalWrite(RedledPin, HIGH);
digitalWrite(GreenledPin, LOW);
delay(200);
digitalWrite(GreenledPin, LOW);
digitalWrite(RedledPin, HIGH);
delay(200);
digitalWrite(GreenledPin, LOW);
}
}