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 Minor_test_serial by
main.cpp@3:c118f868d808, 2018-09-11 (annotated)
- Committer:
- Ramonwaninge
- Date:
- Tue Sep 11 13:51:07 2018 +0000
- Revision:
- 3:c118f868d808
- Parent:
- 2:2c4327bb230a
LED uit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| vsluiter | 0:c8f15874531b | 1 | #include "mbed.h" |
| vsluiter | 0:c8f15874531b | 2 | #include "MODSERIAL.h" |
| vsluiter | 0:c8f15874531b | 3 | |
| vsluiter | 0:c8f15874531b | 4 | DigitalOut myled(LED_GREEN); |
| vsluiter | 0:c8f15874531b | 5 | MODSERIAL pc(USBTX, USBRX); |
| Ramonwaninge | 2:2c4327bb230a | 6 | char c; |
| Ramonwaninge | 2:2c4327bb230a | 7 | |
| Ramonwaninge | 2:2c4327bb230a | 8 | |
| vsluiter | 0:c8f15874531b | 9 | |
| vsluiter | 0:c8f15874531b | 10 | int main() |
| vsluiter | 0:c8f15874531b | 11 | { |
| Ramonwaninge | 2:2c4327bb230a | 12 | while (true){ |
| Ramonwaninge | 2:2c4327bb230a | 13 | c = pc.getc(); |
| vsluiter | 0:c8f15874531b | 14 | pc.baud(115200); |
| Ramonwaninge | 2:2c4327bb230a | 15 | pc.printf("%c\n",c); |
| vsluiter | 0:c8f15874531b | 16 | |
| Ramonwaninge | 2:2c4327bb230a | 17 | |
| Ramonwaninge | 3:c118f868d808 | 18 | \\wait(0.5f); // wait a small period of time |
| Ramonwaninge | 3:c118f868d808 | 19 | \\myled = !myled; // toggle a led |
| Ramonwaninge | 2:2c4327bb230a | 20 | |
| vsluiter | 0:c8f15874531b | 21 | } |
| vsluiter | 0:c8f15874531b | 22 | } |
