エレキジャック Web版 マイコン・カーを製作してみよう<19> xbeeの動作確認用プログラムです。http://www.eleki-jack.com/arm/2012/09/19.html  このプログラムは二つの機能をもっています。一つはPCから送信したデータをmbedで受信し、データをmbedのLCDに表示します。もうひとつの機能は、mbedが受信した文字数をカウントし  そのデータ数をPCに送信しています。

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
sunifu
Date:
Mon Oct 01 14:21:40 2012 +0000
Commit message:
Ver1.0

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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
diff -r 000000000000 -r d2e0061e3a45 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Oct 01 14:21:40 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r d2e0061e3a45 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 01 14:21:40 2012 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+TextLCD lcd(p24, p26, p27, p28, p29, p30); 
+Serial pc(p13,p14);
+
+int i = 0,j;
+char moji[16];
+void  rxFunc(){
+    int k;
+    j = pc.getc();
+    
+    if ( i < 16 ){
+        moji[i] = j;    
+    }else{
+        for ( k = 0 ; k < 15 ; k++)
+            moji[k] = moji[k+1];    
+            moji[15]=j;    
+    }
+    i++;
+    pc.printf("[%c,%2d]",j,i);
+}
+
+int main()
+{
+    lcd.cls();
+    pc.baud(115200);
+    pc.attach(&rxFunc,Serial::RxIrq);
+
+    while(1){
+        lcd.locate(0,0);
+        lcd.printf("%s",moji);
+    }
+       
+}
\ No newline at end of file
diff -r 000000000000 -r d2e0061e3a45 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 01 14:21:40 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/078e4b97a13e
\ No newline at end of file