6 months, 1 week ago.

KL46Z InterruptIn on pin PTE2 not working

Hello everyone. This is my first time asking a question here. I've been trying to use a pin on the KL46Z for an interrupt in. It works fine with the built in switch (SW3) but not pin (PTE2)....or any other pin I've tried for that matter. Here is the code and I've commented on the segment that works/fails depending on the pin declaration. Any advice would be appreciated.

Flash an LED while waiting for events

  1. include "mbed.h" InterruptIn event(PTE2); If I change this to event(SW3) it works just fine DigitalOut led(LED_RED); Serial pc(USBTX, USBRX); void trigger() { pc.printf("triggered!\n"); } int main() { pc.baud(115200); event.rise(&trigger); while(1) { led = !led; wait(0.25); } }
Comment on this question

1 Answer

6 months ago.

Didn't you get an error on the serial line? -> error("gpio_irq only supported on port A,C and D");

Port E does not support interrupts on KL46Z.


You need to log in to post a question