Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: USBDevice_STM32F103
main.cpp@0:038a9831a9b4, 2018-01-15 (annotated)
- Committer:
- SpotlightKid
- Date:
- Mon Jan 15 16:57:02 2018 +0000
- Revision:
- 0:038a9831a9b4
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| SpotlightKid | 0:038a9831a9b4 | 1 | #include "mbed.h" |
| SpotlightKid | 0:038a9831a9b4 | 2 | #include "USBSerial.h" |
| SpotlightKid | 0:038a9831a9b4 | 3 | |
| SpotlightKid | 0:038a9831a9b4 | 4 | DigitalOut myled(LED1); |
| SpotlightKid | 0:038a9831a9b4 | 5 | Serial pc(PA_2, PA_3); |
| SpotlightKid | 0:038a9831a9b4 | 6 | //USBSerial usbSerial; // connection blocks when USB is not plugged in |
| SpotlightKid | 0:038a9831a9b4 | 7 | USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false); // connection is not blocked when USB is not plugged in |
| SpotlightKid | 0:038a9831a9b4 | 8 | |
| SpotlightKid | 0:038a9831a9b4 | 9 | int main() { |
| SpotlightKid | 0:038a9831a9b4 | 10 | while(1) { |
| SpotlightKid | 0:038a9831a9b4 | 11 | myled = !myled; |
| SpotlightKid | 0:038a9831a9b4 | 12 | pc.printf("I am a serial port\r\n"); // 9600 bit/s |
| SpotlightKid | 0:038a9831a9b4 | 13 | usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed) |
| SpotlightKid | 0:038a9831a9b4 | 14 | wait_ms(1000); |
| SpotlightKid | 0:038a9831a9b4 | 15 | } |
| SpotlightKid | 0:038a9831a9b4 | 16 | } |