Answers for "attachinterrupt arduino"

1

attachinterrupt arduino

const byte ledPin = 13;
const byte interruptPin = 2;
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;
}
Posted by: Guest on May-24-2021
4

interrupt arduino

attachInterrupt(digitalPinToInterrupt(interruptPin), someFuntion, CHANGE);
Posted by: Guest on November-11-2020

Browse Popular Code Answers by Language