int pin = 13; volatile int state = LOW; int swState; void setup() { pinMode(pin, OUTPUT); attachInterrupt(0, blink, RISING); } void loop() { digitalWrite(pin, state); } void blink() { state = !state; }