Zoltan Hudak / Mbed OS Blackpill_USBSerial
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "USBSerial.h"
00003 
00004 DigitalOut  led1(LED1);
00005 USBSerial   usbSerial;
00006 
00007 /**
00008  * @brief
00009  * @note
00010  * @param
00011  * @retval
00012  */
00013 int main()
00014 {
00015     printf("Starting ...\r\n");
00016     led1 = 1;                        // The onboard LED is active when digital output is 0
00017     while (true) {
00018         led1 = 0;                    // turn the LED on
00019         ThisThread::sleep_for(50);
00020         led1 = 1;                    // turn the LED off
00021         ThisThread::sleep_for(1000);
00022         printf("Blink\r\n");
00023         usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed)
00024     }
00025 }