UART connection demo.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
alaif
Date:
Wed Jan 25 15:46:25 2012 +0000
Commit message:

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	Wed Jan 25 15:46:25 2012 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+
+Serial device(p9, p10);  // tx, rx
+
+int main() {
+    device.baud(19200);
+    device.printf("?");
+    
+    int i;
+    for (i = 0; i < 20; i++) {
+        device.printf("<NUMK VAL=%d>kaime no zikko'u de_su\r", i + 1);        
+        for (;;) {
+            if(device.readable()) {
+                if (device.getc() == '>') {
+                    break;
+                }
+            }
+            wait(0.5);
+        }
+    }
+    device.printf("owari de_su\r");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 25 15:46:25 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5284544d04b6