miniBLIP usb serial hello world

Dependencies:   USBDevice mbed

Fork of USBSerial_HelloWorld by Samuel Mokrani

Files at this revision

API Documentation at this revision

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
+}