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.
Diff: main.cpp
- Revision:
- 3:4189f06dec07
- Parent:
- 2:f82d4b3f338f
- Child:
- 4:36f4a7c41412
diff -r f82d4b3f338f -r 4189f06dec07 main.cpp --- a/main.cpp Sat Oct 22 09:11:28 2016 +0000 +++ b/main.cpp Sat Oct 22 09:22:57 2016 +0000 @@ -2,94 +2,13 @@ Serial pc(USBTX,USBRX); Serial twe(p13,p14); -char data[74]; -int data_count; -int data_num; -bool datas_title_flag=false; int main() { twe.baud(115200); pc.baud(115200); - data_num=0; - data_count=0; while(1) { if(twe.readable()){ - data[data_count]=twe.getc(); - - if(data[data_count]==';'){ - pc.putc((char)data_num); - data_num++; - datas_title_flag=true; - } - if(data_num==1){ - if(datas_title_flag){ - pc.printf("\n\r time:"); - datas_title_flag=false; - }else{ - pc.putc(data[data_count]); - } - data_count++; - } - if(data_num==2){ - if(datas_title_flag){ - datas_title_flag=false; - data_count++; - }else if(data[data_count]=='\n\r'){ - for(int i=0;i<74;i++) data[i]= NULL; - data_num=0; - pc.putc('!'); - data_count=0; - }else data_count++; - } - if(data_num==6){ - if(datas_title_flag){ - pc.printf("\n\r voltage:"); - datas_title_flag=false; - }else{ - pc.putc(data[data_count]); - } - data_count++; - } - //if(data_num==12){ - // if(!datas_title_flag){ - // pc.printf("\n\r X:"); - // datas_title_flag=true; - // }else{ - // pc.putc(data[data_count]) - // } - // } - // if(data_num==13){ - // if(!datas_title_flag){ - // pc.printf("\n\r Y:"); - // datas_title_flag=true; - // }else{ - // pc.putc(data[data_count]); - // } - // } - if(data_num==14){ - if(datas_title_flag){ - pc.printf("\n\r Z:"); - datas_title_flag=false; - }else{ - pc.putc(data[data_count]); - } - data_count++; - } - if(data_num==15){ - if(datas_title_flag){ - datas_title_flag=false; - data_count++; - }else{ - for(int i=0;i<74;i++)data[i]=NULL; - data_num=0; - data_count=0; - } - - } - - - - } //readable - }//while -} //main -//一行72文字 + pc.putc(twe.getc()); + } + } +}//;97;00000000;147;022 ;10084fb;2890;0000;0 000;1524;1075;G;-006 ;0004;0001; 71(min)73(max)