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.
main.cpp
- Committer:
- TUATBM
- Date:
- 2018-09-07
- Revision:
- 0:a1acaff29a23
File content as of revision 0:a1acaff29a23:
#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); } } }