航空研究会
/
uarttest
z
Revision 0:a1acaff29a23, committed 2018-09-07
- Comitter:
- TUATBM
- Date:
- Fri Sep 07 05:26:27 2018 +0000
- Commit message:
- a
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Fri Sep 07 05:26:27 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 07 05:26:27 2018 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" + +/*送信*/ +/* +Serial g_Serial1(USBTX,USBRX); +Serial g_serial2(PB_6, PB_7); + +int main() { + g_serial2.baud(9600); + + char k[]="Hello world!"; + while(1) { + g_serial2.printf( "%s\r\n",k); + wait(1.0); + printf("a\r\n"); + } +} +*/ + + +/*受信*/ + +#include "mbed.h" + +Serial MySerial1(USBTX,USBRX); +Serial MySerial2(PA_9,PA_10); + +int main() { + while(1) { + char c; + + if (MySerial1.readable()) + { + c = MySerial1.getc(); + while(!MySerial2.writeable()) + { + // 受信可能になるまで、ループ + } + MySerial2.putc(c); + } + + if (MySerial2.readable()) + { + c = MySerial2.getc(); + while(!MySerial1.writeable()) + { + // 受信可能になるまで、ループ + } + MySerial1.putc(c); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 07 05:26:27 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file