使用アプリ:Android USB Serial Monitor Lite
使用ケーブル:エレコムのU2HS-MB02-4S
mbed側のプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mbed.h" | |
Serial pc(USBTX, USBRX); // tx:送信, rx:受信 | |
void rxCallback() | |
{ | |
pc.putc(pc.getc()); | |
} | |
int main() | |
{ | |
pc.attach(rxCallback, Serial::RxIrq); | |
while (1) { | |
pc.printf("Hello World!\n"); | |
wait(0.5); | |
} | |
} |
アンドロイドから mbed に文字を送信したら、mbedは割り込みで受信して、
アンドロイドにその文字を送り返す。
0 件のコメント:
コメントを投稿