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
Diff: main.cpp
- Revision:
- 0:038a9831a9b4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Jan 15 16:57:02 2018 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+#include "USBSerial.h"
+
+DigitalOut myled(LED1);
+Serial pc(PA_2, PA_3);
+//USBSerial usbSerial; // connection blocks when USB is not plugged in
+USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false); // connection is not blocked when USB is not plugged in
+
+int main() {
+ while(1) {
+ myled = !myled;
+ pc.printf("I am a serial port\r\n"); // 9600 bit/s
+ usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed)
+ wait_ms(1000);
+ }
+}