Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
features/unsupported/tests/mbed/serial_interrupt/main.cpp
- Committer:
- jacobjohnson
- Date:
- 2017-02-27
- Revision:
- 1:f30bdcd2b33b
- Parent:
- 0:098463de4c5d
File content as of revision 1:f30bdcd2b33b:
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
Serial computer(USBTX, USBRX);
// This function is called when a character goes into the TX buffer.
void txCallback() {
led1 = !led1;
}
// This function is called when a character goes into the RX buffer.
void rxCallback() {
led2 = !led2;
computer.putc(computer.getc());
}
int main() {
printf("start test\n");
computer.attach(&txCallback, Serial::TxIrq);
computer.attach(&rxCallback, Serial::RxIrq);
while (true) {
wait(1);
}
}