const int buttonPin = A0; // the number of the pushbutton pin
const int ledPin = A1; // the number of the LED pin
byte oldPinState = HIGH;
void setup ()
{
pinMode (buttonPin, INPUT_PULLUP);
pinMode (ledPin, OUTPUT);
} // end of setup
void loop ()
{
byte pinState = digitalRead (buttonPin);
if (pinState != oldPinState)
{
delay (10); // debounce
if (pinState == LOW)
digitalWrite (ledPin, !digitalRead (ledPin)); // toggle pin
oldPinState = pinState; // remember new state
} // end of if pin state change
} // end of loop