Skip to content

Raspberry pi pico external interrupts not working #253

Closed
@Chick92

Description

@Chick92

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions