Serial communication

Dependencies:   mbed

Revision:
0:ef5992a8b537
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 24 23:09:16 2014 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+
+DigitalOut myled(LED_GREEN);
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+    int i = 0;
+    pc.printf("Hello World!\n");
+
+    while (true) {
+        wait(0.5f); // wait a small period of time
+        pc.printf("%d \n", i); // print the value of variable i
+        i++; // increment the variable
+        myled = !myled; // toggle a led
+    }
+}