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.
Fork of RawSerial_ex_2 by
main.cpp@2:4ab47f33a1ae, 2018-01-10 (annotated)
- Committer:
- Kojto
- Date:
- Wed Jan 10 14:24:47 2018 +0000
- Revision:
- 2:4ab47f33a1ae
- Parent:
- 0:3b040f367dd8
putc instead of printf (not allowed in ISR)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mab5449 | 0:3b040f367dd8 | 1 | #include "mbed.h" |
| mab5449 | 0:3b040f367dd8 | 2 | |
| mab5449 | 0:3b040f367dd8 | 3 | DigitalOut led1(LED1); |
| mab5449 | 0:3b040f367dd8 | 4 | DigitalOut led2(LED2); |
| mab5449 | 0:3b040f367dd8 | 5 | |
| mab5449 | 0:3b040f367dd8 | 6 | Serial pc(USBTX, USBRX); |
| mab5449 | 0:3b040f367dd8 | 7 | |
| mab5449 | 0:3b040f367dd8 | 8 | void callback_ex() { |
| mab5449 | 0:3b040f367dd8 | 9 | // Note: you need to actually read from the serial to clear the RX interrupt |
| Kojto | 2:4ab47f33a1ae | 10 | pc.putc(pc.getc()); |
| mab5449 | 0:3b040f367dd8 | 11 | led2 = !led2; |
| mab5449 | 0:3b040f367dd8 | 12 | } |
| mab5449 | 0:3b040f367dd8 | 13 | |
| mab5449 | 0:3b040f367dd8 | 14 | int main() { |
| mab5449 | 0:3b040f367dd8 | 15 | pc.attach(&callback_ex); |
| mab5449 | 0:3b040f367dd8 | 16 | |
| mab5449 | 0:3b040f367dd8 | 17 | while (1) { |
| mab5449 | 0:3b040f367dd8 | 18 | led1 = !led1; |
| mab5449 | 0:3b040f367dd8 | 19 | wait(0.5); |
| mab5449 | 0:3b040f367dd8 | 20 | } |
| mab5449 | 0:3b040f367dd8 | 21 | } |
