
Hello world program
Diff: main.cpp
- Revision:
- 0:e30516181c1e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 06 13:09:22 2021 +0000 @@ -0,0 +1,27 @@ +/* mbed Microcontroller Library + * Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" +#include "platform/mbed_thread.h" + + +// Blinking rate in milliseconds +#define BLINKING_RATE_MS 500 + + +int main() +{ + // Initialize the digital pin LED1 as an output + DigitalOut led(LED1); + // Initialize the serial UART on the USB Transmit and Receive pins + Serial pc(USBTX, USBRX); + // Print a string on the serial port + pc.printf("Hello World!\n"); + while (true) + { + led = !led; + thread_sleep_for(BLINKING_RATE_MS); + } +}