Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ogata_lab
Date:
Thu Jun 06 06:19:11 2013 +0000
Commit message:
Console Example

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 06 06:19:11 2013 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "Serial.h"
+
+Serial usbSerial(USBTX, USBRX);
+
+DigitalOut leds[4] = {LED1, LED2, LED3, LED4};
+
+int main() {
+    usbSerial.printf("Hello World!");
+    while(1) {
+        char c = usbSerial.getc();
+        switch(c) {
+        case '1':
+            leds[0] = 1;
+            break;
+        case '2':
+            leds[1] = 1;
+            break;
+        case '3':
+            leds[2] = 1;
+            break;
+        case '4':
+            leds[3] = 1;
+            break;
+        default:
+            leds[0] = 0;
+            leds[1] = 0;
+            leds[2] = 0;
+            leds[3] = 0;
+            break;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 06 06:19:11 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file