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.
9 years, 1 month ago.
Attach to RX Interrupt doesn't work
uart
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
Serial pc(USBTX, USBRX);
void callback() {
// Note: you need to actually read from the serial to clear the RX interrupt
printf("%c\n", pc.getc());
led2 = !led2;
}
int main() {
pc.attach(&callback);
while (1) {
led1 = !led1;
wait(0.5);
}
it doesn't work , the led1 blink but the program doesn't make the callback, can someone help me? Thanks.