Interrupt program not working

I used this code I found on the Arduino site, but it does not work on my board. It does not blink the LED. If I download the regular blink sketch, it works. I am doing this in windows 7 and though it has worked in the past I have been having trouble the last few days. If I try to upload a sketch without holding down the 'L' key, it will not load and I get a protocol error something about expecting 0x14, received 0x51. If I hold the 'L' key down for verbose output, it seems to load and the blink sketch works, but I am unable to get this interrupt program to work. Is there something wrong with this program? It looks like it should work.


int pin = 13;
volatile int state = LOW;

void setup()
  pinMode(pin, OUTPUT);
  attachInterrupt(0, blink, CHANGE);

void loop()
  digitalWrite(pin, state);

void blink()
  state = !state;

Interrupt 0 uses pin 2. What have you attached to Pin2? Your program doesn't enable the internal pull-up resistors so are you using external pull-ups (or pull-downs)?

Yea, I guess that was not a working example. I found the example on and I assumed it was supposed to work. I thought it was a bit strange there were no instructions to hook up anything to one of the pins. I guess I will find another example that includes a working circuit to follow. Thanks though.

Use this circuit: