Paul Jeon
/
serial-port-check
:D
Diff: serialPortCheck.cpp
- Revision:
- 0:e341ea4101e9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serialPortCheck.cpp Fri Feb 21 18:57:13 2020 +0000 @@ -0,0 +1,28 @@ +/* mbed Microcontroller Library + * Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" +#include "USBSerial.h" + +// Blinking rate in milliseconds +#define BLINKING_RATE_MS 500 + +// Virtual serial port over USB +USBSerial microUSB; +//Serial pc(USBTX, USBRX); +char buf[40]; +int main() +{ + // Initialise the digital pin LED1 as an output + DigitalOut led(LED1); + + while (true) { + microUSB.scanf("%s", buf); + led = !led; +// pc.printf("regular serial communication works!"); + microUSB.printf("you typed: %s\r\n",buf); + //microUSB.printf("\x1B[2J"); //clear terminal program screen + } +} \ No newline at end of file