/*using pin 1 as the input of the switch, an pin 2 as the led*/
boolean led1 =FALSE; // the status of the led
boolean status1= FALSE; //the status of the button
if (digitalRead(1)!=status1){ // if the button is different that in wat before
if (status1)led1!=led1; //if the button is being pushed, toggle the led
status1 = digitalRead1(1);
digitalWrite(2,led1); // update the led
}
i hope this helps you