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.
Revision 2:c9a1ef1c71d4, committed 2021-03-16
- Comitter:
- dshin
- Date:
- Tue Mar 16 16:09:45 2021 +0000
- Parent:
- 1:ddc617f4c5d3
- Commit message:
- my-first-blinky
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Mar 16 15:47:02 2021 +0000 +++ b/main.cpp Tue Mar 16 16:09:45 2021 +0000 @@ -1,23 +1,18 @@ -/* mbed Microcontroller Library - * Copyright (c) 2019 ARM Limited - * SPDX-License-Identifier: Apache-2.0 - */ +#include "mbed.h" -#include "mbed.h" -#include "platform/mbed_thread.h" - +// https://os.mbed.com/docs/mbed-os/v5.15/tools/creating-a-new-program.html -// Blinking rate in milliseconds -#define BLINKING_RATE_MS 500 - +Serial pc(USBTX, USBRX, 115200); // baud rate 115200 +DigitalOut led(LED1); // led = LED1 int main() { - // Initialise the digital pin LED1 as an output - DigitalOut led(LED1); - while (true) { - led = !led; - thread_sleep_for(BLINKING_RATE_MS); + led = 0; + printf("LED1 is ON\r\n"); + thread_sleep_for(500); + led = 1; + printf("LED1 is OFF\r\n"); + thread_sleep_for(500); } -} +} \ No newline at end of file