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@2:794c87b4a13a, 2018-09-12 (annotated)
- Committer:
- bjonkheer
- Date:
- Wed Sep 12 11:07:49 2018 +0000
- Revision:
- 2:794c87b4a13a
- Parent:
- 1:40470bc517f1
- Child:
- 3:2a93e9b6b42a
begin code
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); |
| vsluiter | 0:c8f15874531b | 6 | |
| vsluiter | 0:c8f15874531b | 7 | int main() |
| vsluiter | 0:c8f15874531b | 8 | { |
| bjonkheer | 2:794c87b4a13a | 9 | char c; |
| vsluiter | 0:c8f15874531b | 10 | pc.baud(115200); |
| Gijsvanoort | 1:40470bc517f1 | 11 | pc.printf("Hello World!\r\n"); |
| bjonkheer | 2:794c87b4a13a | 12 | myled = 1; |
| vsluiter | 0:c8f15874531b | 13 | while (true) { |
| bjonkheer | 2:794c87b4a13a | 14 | c = pc.getc(); |
| bjonkheer | 2:794c87b4a13a | 15 | pc.printf("%c \r\n", c); // print the value of variable i |
| bjonkheer | 2:794c87b4a13a | 16 | myled = !myled; // toggle a led |
| vsluiter | 0:c8f15874531b | 17 | wait(0.5f); // wait a small period of time |
| vsluiter | 0:c8f15874531b | 18 | myled = !myled; // toggle a led |
| bjonkheer | 2:794c87b4a13a | 19 | |
| vsluiter | 0:c8f15874531b | 20 | } |
| vsluiter | 0:c8f15874531b | 21 | } |
