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 1:6b743a29c48a, committed 2013-03-12
- Comitter:
- samux
- Date:
- Tue Mar 12 17:33:20 2013 +0000
- Parent:
- 0:7528379ed84d
- Child:
- 2:8f3478b5d434
- Commit message:
- use latest USBHost
Changed in this revision
| USBHost.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHost.lib Wed Mar 06 17:07:28 2013 +0000 +++ b/USBHost.lib Tue Mar 12 17:33:20 2013 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/USBHost/#a554658735bf +https://mbed.org/users/mbed_official/code/USBHost/#b320d68e98e7
--- a/main.cpp Wed Mar 06 17:07:28 2013 +0000
+++ b/main.cpp Tue Mar 12 17:33:20 2013 +0000
@@ -5,34 +5,27 @@
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
+ while (1) {
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);
+
+ while (serial.available()) {
+ printf("%c", serial.getc());
}
+ Thread::wait(50);
}
-
}
}
int main() {
- Thread serialTask(serial_task, NULL, osPriorityNormal, 1024 * 4);
+ Thread serialTask(serial_task, NULL, osPriorityNormal, 256 * 4);
while(1) {
led=!led;
Thread::wait(500);
