Hi,
The code below works well when const byte interruptPin = 2;
the LED ON/OFF by button;
the LED keep ON when changed into const byte interruptPin = 3;
.
why?
Thanks
Adam
const byte ledPin = 13;
const byte interruptPin = 3;
volatile byte state = LOW;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
state = !state;
}