int buttonstate=0;
void setup() {
// put your setup code here, to run once:
pinMode(14, OUTPUT); //LED PIN
pinMode(12, INPUT); //BUTTON PIN
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
buttonstate=digitalRead(12);
if(buttonstate==1)
{
digitalWrite(14, HIGH);
delay(2000);
}
if(buttonstate==0)
{
digitalWrite(14, LOW);
delay(2000);
}
}