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@0:2912fe6f7530, 2021-01-30 (annotated)
- Committer:
- hudakz
- Date:
- Sat Jan 30 11:18:14 2021 +0000
- Revision:
- 0:2912fe6f7530
- Child:
- 1:60fefa7f384b
Using USBSerial on BLACKPILL board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:2912fe6f7530 | 1 | // Blinky demo for the STM32F407VET6 boards. |
hudakz | 0:2912fe6f7530 | 2 | // See http://wiki.stm32duino.com/index.php?title=STM32F407. |
hudakz | 0:2912fe6f7530 | 3 | // |
hudakz | 0:2912fe6f7530 | 4 | // Use "Seed Arch Max" as target platform for the online compiler. |
hudakz | 0:2912fe6f7530 | 5 | #include "mbed.h" |
hudakz | 0:2912fe6f7530 | 6 | #include "USBSerial.h" |
hudakz | 0:2912fe6f7530 | 7 | |
hudakz | 0:2912fe6f7530 | 8 | DigitalOut led1(LED1); |
hudakz | 0:2912fe6f7530 | 9 | USBSerial usbSerial; // connection is not blocked when USB is not plugged in |
hudakz | 0:2912fe6f7530 | 10 | |
hudakz | 0:2912fe6f7530 | 11 | /** |
hudakz | 0:2912fe6f7530 | 12 | * @brief |
hudakz | 0:2912fe6f7530 | 13 | * @note |
hudakz | 0:2912fe6f7530 | 14 | * @param |
hudakz | 0:2912fe6f7530 | 15 | * @retval |
hudakz | 0:2912fe6f7530 | 16 | */ |
hudakz | 0:2912fe6f7530 | 17 | int main() |
hudakz | 0:2912fe6f7530 | 18 | { |
hudakz | 0:2912fe6f7530 | 19 | printf("Starting ...\r\n"); |
hudakz | 0:2912fe6f7530 | 20 | led1 = 1; // off |
hudakz | 0:2912fe6f7530 | 21 | while (true) { |
hudakz | 0:2912fe6f7530 | 22 | led1 = 0; // on |
hudakz | 0:2912fe6f7530 | 23 | ThisThread::sleep_for(50); |
hudakz | 0:2912fe6f7530 | 24 | led1 = 1; // off |
hudakz | 0:2912fe6f7530 | 25 | ThisThread::sleep_for(1000); |
hudakz | 0:2912fe6f7530 | 26 | printf("Blink\r\n"); |
hudakz | 0:2912fe6f7530 | 27 | usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed) |
hudakz | 0:2912fe6f7530 | 28 | } |
hudakz | 0:2912fe6f7530 | 29 | } |