Samuel Mokrani
/
USBSerial_Echo
USBSerial echo example
Revision 5:fa2fa6aa36b1, committed 2011-11-17
- Comitter:
- samux
- Date:
- Thu Nov 17 16:36:00 2011 +0000
- Parent:
- 4:583cafe16ec7
- Child:
- 6:58aedc90c7e9
- Commit message:
Changed in this revision
USBDevice.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/USBDevice.lib Thu Nov 17 12:01:32 2011 +0000 +++ b/USBDevice.lib Thu Nov 17 16:36:00 2011 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/samux/code/USBDevice/#76071370dd0a +http://mbed.org/users/samux/code/USBDevice/#ef8c6751b185
--- a/main.cpp Thu Nov 17 12:01:32 2011 +0000 +++ b/main.cpp Thu Nov 17 16:36:00 2011 +0000 @@ -6,17 +6,11 @@ Serial pc(USBTX, USBRX); int main(void) { - char buf[128]; - char echo[128]; + uint8_t buf[128]; while(1) { serial.scanf("%s", buf); - - // build the echo response - sprintf(echo, "recv: %s\r\n", buf); - - //send to the virtual serial port and the mbed serial port - serial.print(echo); - pc.printf("%s", echo); + serial.printf("recv: %s\r\n", buf); + pc.printf("recv: %s\r\n", buf); } }