藤田さんが教えてくれたコード.ボーレートを38400に設定しているのはマイコン側のIM920を受信にしているとき,19200だとうまく読み取れないから.コマンドはインタープランのサイトを参照
Dependencies: mbed
Revision 0:654a49387753, committed 2020-08-19
- Comitter:
- falconsyunya
- Date:
- Wed Aug 19 14:01:11 2020 +0000
- Commit message:
- 2020/08/19
Changed in this revision
diff -r 000000000000 -r 654a49387753 .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Wed Aug 19 14:01:11 2020 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
diff -r 000000000000 -r 654a49387753 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 19 14:01:11 2020 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +int main() +{ + Serial pc(USBTX, USBRX,38400);//ボーレートを落とすと,USB側からのデータが正確に出力されない. + Serial uart(PA_9,PA_10,19200);//TX(IM920_RX), RX(IM920_TX) + + DigitalOut pc_activity(LED1); + DigitalOut uart_activity(LED2); + + while(1) { + if(pc.readable()) { + uart.putc(pc.getc()); + pc_activity = !pc_activity; + } + if(uart.readable()) { + pc.putc(uart.getc()); + uart_activity = !uart_activity; + } + } + +}
diff -r 000000000000 -r 654a49387753 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Aug 19 14:01:11 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file