const byte ledPin = 5;
const byte interruptPin = 2;
volatile byte state = LOW;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin,OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin),blink,CHANGE);
}
void loop() {
// put your main code here, to run repeatedly:
while(1){
digitalWrite(ledPin,state);
}
}
void blink(){
state = !state;
}