Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 1:c373f768ba41, committed 2021-05-17
- Comitter:
- falconsyunya
- Date:
- Mon May 17 11:28:46 2021 +0000
- Parent:
- 0:654a49387753
- Commit message:
- 2021/05/17
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Aug 19 14:01:11 2020 +0000 +++ b/main.cpp Mon May 17 11:28:46 2021 +0000 @@ -1,21 +1,14 @@ +//シリアルモニタに入力した文字をマイコンを介してIM920に送る&IM920で受信したデータをマイコンを介してシリアルモニタに送る. +//シリアルモニタのボーレートは38400以上で. #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; - } + if(pc.readable())uart.putc(pc.getc());//pcから入力アリ⇒pcからの入力get⇒uartに出力 + if(uart.readable())pc.putc(uart.getc());//uartから入力アリ⇒uartからの入力get⇒pcに出力 } }