File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## USBCDC example
2
+
3
+ The example sends string in the loop using an emulated serial port over USB.
4
+
5
+ 1 . Flash the board, and ensure the target's auxiliary USB is plugged into the PC.
6
+ 2 . Open serial console (select associated COM port, transmission speed: 9600 bps).
7
+ 3 . Reset the target.
8
+ 4 . "Hello world" string should appear in the loop on the serial console in the 1-second delays.
9
+
10
+ ** Note:** On Windows you can check the associated COM port in the Device Manager (USB Serial Device).
11
+ ** Note:** If you want printf functionality, please see the USBSerial class.
Original file line number Diff line number Diff line change
1
+ #include " mbed.h"
2
+ #include " USBCDC.h"
3
+
4
+ USBCDC cdc;
5
+
6
+ int main (void ) {
7
+
8
+ while (1 )
9
+ {
10
+ char msg[] = " Hello world\r\n " ;
11
+ cdc.send ((uint8_t *)msg, strlen (msg));
12
+ wait (1.0 );
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments