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.
Fork of USBSerial_HelloWorld by
Revision 11:4d863ea0d088, committed 2015-12-04
- Comitter:
- pighixxx
- Date:
- Fri Dec 04 16:03:23 2015 +0000
- Parent:
- 10:dc64a826c87b
- Commit message:
- added scanf example
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r dc64a826c87b -r 4d863ea0d088 main.cpp --- a/main.cpp Sun Nov 29 11:51:13 2015 +0000 +++ b/main.cpp Fri Dec 04 16:03:23 2015 +0000 @@ -5,10 +5,15 @@ USBSerial serial; int main(void) { + char buffer[128]; // Max char in buffer serial.printf("miniBlip\r\n"); while(1) { - serial.printf("Hello World\r\n"); + serial.scanf("%s\n", &buffer); + serial.printf("Received: '%s'\n", buffer); + if(strcmp(buffer,"miniBLIP")==0) { + // Do something + } wait(1); } -} \ No newline at end of file +}