void setup() { pinMode( 2 , INPUT); pinMode( 12 , OUTPUT); } void loop() { if (digitalRead( 2 )) //If press the button once then the LED will light up { digitalWrite( 12 , HIGH ); } if (digitalRead( 2 )) { digitalWrite( 12 , LOW ); //If press the button the second time then the LED will be turned off } }