check program for USB Serial

Dependencies:   USBDevice

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Mon Apr 16 10:48:20 2018 +0000
Parent:
0:941291e23892
Commit message:
check program for USB Serial

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Aug 03 13:27:41 2017 +0000
+++ b/main.cpp	Mon Apr 16 10:48:20 2018 +0000
@@ -1,24 +1,31 @@
 #include "mbed.h"
 #include "USBSerial.h"
 
+Serial pc(USBTX, USBRX, 921600);
 // Virtual USB Serial port
 USBSerial usb_serial;
-
 DigitalOut led(LED1);
+Timer t;
 
 int main(void)
 {
-    int i = 0;
+    uint32_t i = 0;
+    uint32_t dt;
 
     // Print on STDIO
     printf("USBDevice Serial started\r\n");
 
     while(1) {
-
+        t.reset();
+        t.start();
+#if 1
         // Print on Virtual USB Serial port
-        usb_serial.printf("I am a virtual serial port: %d\r\n", i++);
-
+        usb_serial.printf("I am a virtual serial port: %d, %d\r\n", i++, dt);
+#else
+        // Print on V-COM
+        pc.printf("I am a virtual serial port: %d, %d\r\n", i++, dt);
+#endif
         led = !led;
-        wait(0.1);
+        dt = t.read_us();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon Apr 16 10:48:20 2018 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#f9ee4e849f8cbd64f1ec5fdd4ad256585a208360
--- a/mbed.bld	Thu Aug 03 13:27:41 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a97add6d7e64
\ No newline at end of file