Closed
Description
Can't get any encoder library to work using interrupts. Ones that are able to, work fine when polling the state of the pins, but this won't be suitable for my task.
Tried with a simple interrupt sketch, also no response at all.
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;
}
Metadata
Metadata
Assignees
Labels
No labels