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: C12832_lcd Servo USBHost mbed
Fork of USBHostSerial_HelloWorld by
Revision 0:7528379ed84d, committed 2013-03-06
- Comitter:
- samux
- Date:
- Wed Mar 06 17:07:28 2013 +0000
- Child:
- 1:6b743a29c48a
- Commit message:
- USBHostSerial Hello World
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBHost.lib Wed Mar 06 17:07:28 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/USBHost/#a554658735bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 06 17:07:28 2013 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "USBHostSerial.h"
+
+DigitalOut led(LED1);
+Serial pc(USBTX, USBRX);
+
+void serial_task(void const*) {
+ char buf[100];
+ USBHostSerial serial;
+
+ while(1) {
+
+ // try to connect a virtual serial port
+ while(!serial.connect())
+ Thread::wait(500);
+
+ while(1) {
+
+ // if serial not connected, try to connect again
+ if (!serial.connected())
+ break;
+
+ // if char available on the virtual serial port, print them
+ if (serial.available()) {
+ serial.scanf("%s", buf);
+ printf("recv: %s\r\n", buf);
+ }
+
+ }
+
+ }
+}
+
+int main() {
+ Thread serialTask(serial_task, NULL, osPriorityNormal, 1024 * 4);
+ while(1) {
+ led=!led;
+ Thread::wait(500);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 06 17:07:28 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b \ No newline at end of file
