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.
main.cpp@2:c9a1ef1c71d4, 2021-03-16 (annotated)
- Committer:
- dshin
- Date:
- Tue Mar 16 16:09:45 2021 +0000
- Revision:
- 2:c9a1ef1c71d4
- Parent:
- 0:302424d154ab
my-first-blinky
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dshin | 2:c9a1ef1c71d4 | 1 | #include "mbed.h" |
dshin | 0:302424d154ab | 2 | |
dshin | 2:c9a1ef1c71d4 | 3 | // https://os.mbed.com/docs/mbed-os/v5.15/tools/creating-a-new-program.html |
dshin | 0:302424d154ab | 4 | |
dshin | 2:c9a1ef1c71d4 | 5 | Serial pc(USBTX, USBRX, 115200); // baud rate 115200 |
dshin | 2:c9a1ef1c71d4 | 6 | DigitalOut led(LED1); // led = LED1 |
dshin | 0:302424d154ab | 7 | |
dshin | 0:302424d154ab | 8 | int main() |
dshin | 0:302424d154ab | 9 | { |
dshin | 0:302424d154ab | 10 | while (true) { |
dshin | 2:c9a1ef1c71d4 | 11 | led = 0; |
dshin | 2:c9a1ef1c71d4 | 12 | printf("LED1 is ON\r\n"); |
dshin | 2:c9a1ef1c71d4 | 13 | thread_sleep_for(500); |
dshin | 2:c9a1ef1c71d4 | 14 | led = 1; |
dshin | 2:c9a1ef1c71d4 | 15 | printf("LED1 is OFF\r\n"); |
dshin | 2:c9a1ef1c71d4 | 16 | thread_sleep_for(500); |
dshin | 0:302424d154ab | 17 | } |
dshin | 2:c9a1ef1c71d4 | 18 | } |