Hello,
I have some problems with my code :
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
Serial computer(USBTX, USBRX);
// This function is called when a character goes into the TX buffer.
void txCallback() {
led2 = !led2;
}
// This function is called when a character goes into the RX buffer.
void rxCallback() {
led3 = !led3;
}
int main() {
computer.baud(115200);
computer.attach(&txCallback, Serial::TxIrq);
computer.attach(&rxCallback, Serial::RxIrq);
while (1) {
led1 = !led1;
wait(0.5);
computer.putc('A');
wait(0.5);
}
}
At beginning, Led 1 & Led 2 blink. it's ok.
When mbed receive some instructions through serial pin, Led 3 turn on, and then nothing happens. 3 leds stop blinking.
Do you have an issue for this problem please .??
Thanks :)
Hello,
I have some problems with my code :
#include "mbed.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); Serial computer(USBTX, USBRX); // This function is called when a character goes into the TX buffer. void txCallback() { led2 = !led2; } // This function is called when a character goes into the RX buffer. void rxCallback() { led3 = !led3; } int main() { computer.baud(115200); computer.attach(&txCallback, Serial::TxIrq); computer.attach(&rxCallback, Serial::RxIrq); while (1) { led1 = !led1; wait(0.5); computer.putc('A'); wait(0.5); } }At beginning, Led 1 & Led 2 blink. it's ok.
When mbed receive some instructions through serial pin, Led 3 turn on, and then nothing happens. 3 leds stop blinking.
Do you have an issue for this problem please .??
Thanks :)