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
00001 #include "mbed.h" 00002 00003 /*送信*/ 00004 /* 00005 Serial g_Serial1(USBTX,USBRX); 00006 Serial g_serial2(PB_6, PB_7); 00007 00008 int main() { 00009 g_serial2.baud(9600); 00010 00011 char k[]="Hello world!"; 00012 while(1) { 00013 g_serial2.printf( "%s\r\n",k); 00014 wait(1.0); 00015 printf("a\r\n"); 00016 } 00017 } 00018 */ 00019 00020 00021 /*受信*/ 00022 00023 #include "mbed.h" 00024 00025 Serial MySerial1(USBTX,USBRX); 00026 Serial MySerial2(PA_9,PA_10); 00027 00028 int main() { 00029 while(1) { 00030 char c; 00031 00032 if (MySerial1.readable()) 00033 { 00034 c = MySerial1.getc(); 00035 while(!MySerial2.writeable()) 00036 { 00037 // 受信可能になるまで、ループ 00038 } 00039 MySerial2.putc(c); 00040 } 00041 00042 if (MySerial2.readable()) 00043 { 00044 c = MySerial2.getc(); 00045 while(!MySerial1.writeable()) 00046 { 00047 // 受信可能になるまで、ループ 00048 } 00049 MySerial1.putc(c); 00050 } 00051 } 00052 }
Generated on Wed Jul 27 2022 23:07:25 by
1.7.2