Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 7 months 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
- 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); } }
1 Answer
5 years, 7 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.