コウスケ スズキ
/
Xbee1-2
xbee(ATmode/ マイコン対マイコン, 地上局) なんか問題がある
Revision 0:f59c015ad4b2, committed 2022-08-11
- Comitter:
- kosukesuzuki
- Date:
- Thu Aug 11 15:15:14 2022 +0000
- Commit message:
- down-xbee
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 |
diff -r 000000000000 -r f59c015ad4b2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Aug 11 15:15:14 2022 +0000 @@ -0,0 +1,29 @@ +//地上局のXbeeプログラミング(もし地上局にmbedを使用する場合) +#include "mbed.h" + +Serial pc(USBTX,USBRX); //tx,rx +Serial xbee(p13,p14); //tx,rx + +int i = 0; + +int main(){//1 + + xbee.baud(9600); + char cmd; + for(;;){//2 + + sscanf("%x",&cmd); //一文字だけ? + + while(1){//3 + xbee.printf("%x",cmd); //cmdを送信 + + int va1 = xbee.readable(); //確認 + + if(va1 == 1){//4 //受信できたら + pc.printf("%d cmd ok\r\n",i); //完了マーク + i = i + 1; + }//4 + va1 = 0; + }//3 + }//2 +}//1 \ No newline at end of file
diff -r 000000000000 -r f59c015ad4b2 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Aug 11 15:15:14 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file