So I am attempting to listen to an interrupt from a specific pin, but the function attached to the interrupt is not executing.
Could someone point out what im doing wrong? Im using a rp2040 raspberry pi pico board using the latest core by Earle E Philhower V2.2.0
bool pressEvent = false;
const int interruptPin = 9;
void switchPressed() {
pressEvent = true;
}
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Starting");
pinMode(interruptPin, INPUT);
Serial.println("Listening to touchpad");
attachInterrupt(digitalPinToInterrupt(interruptPin), switchPressed, RISING);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print(digitalRead(interruptPin));
Serial.print("\t");
Serial.println(pressEvent);
}
As you can see in the serial monitor the print for pressEvent remains 0 even though digitalRead sees a logic high. The signal is there, so it would seem to point that im doing something wrong with my code?