![](/media/cache/profiles/7c39a5f991bef4a1e34187677a65871d.jpg.50x50_q85.jpg)
Using USBSerial on BLACKPILL board.
For more details click on the link below:
Import programBlackpill_Hello
Using low cost Blackpill (STM32F411CEU6) boards with mbed.
main.cpp@2:9625237e90fa, 2021-02-11 (annotated)
- Committer:
- hudakz
- Date:
- Thu Feb 11 06:28:02 2021 +0000
- Revision:
- 2:9625237e90fa
- Parent:
- 1:60fefa7f384b
USBSerial on BLACKPILL (STM32F411CE) board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:2912fe6f7530 | 1 | #include "mbed.h" |
hudakz | 0:2912fe6f7530 | 2 | #include "USBSerial.h" |
hudakz | 0:2912fe6f7530 | 3 | |
hudakz | 0:2912fe6f7530 | 4 | DigitalOut led1(LED1); |
hudakz | 2:9625237e90fa | 5 | USBSerial usbSerial; |
hudakz | 0:2912fe6f7530 | 6 | |
hudakz | 0:2912fe6f7530 | 7 | /** |
hudakz | 0:2912fe6f7530 | 8 | * @brief |
hudakz | 0:2912fe6f7530 | 9 | * @note |
hudakz | 0:2912fe6f7530 | 10 | * @param |
hudakz | 0:2912fe6f7530 | 11 | * @retval |
hudakz | 0:2912fe6f7530 | 12 | */ |
hudakz | 0:2912fe6f7530 | 13 | int main() |
hudakz | 0:2912fe6f7530 | 14 | { |
hudakz | 0:2912fe6f7530 | 15 | printf("Starting ...\r\n"); |
hudakz | 2:9625237e90fa | 16 | led1 = 1; // The onboard LED is active when digital output is 0 |
hudakz | 0:2912fe6f7530 | 17 | while (true) { |
hudakz | 2:9625237e90fa | 18 | led1 = 0; // turn the LED on |
hudakz | 0:2912fe6f7530 | 19 | ThisThread::sleep_for(50); |
hudakz | 2:9625237e90fa | 20 | led1 = 1; // turn the LED off |
hudakz | 0:2912fe6f7530 | 21 | ThisThread::sleep_for(1000); |
hudakz | 0:2912fe6f7530 | 22 | printf("Blink\r\n"); |
hudakz | 0:2912fe6f7530 | 23 | usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed) |
hudakz | 0:2912fe6f7530 | 24 | } |
hudakz | 0:2912fe6f7530 | 25 | } |