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
Diff: main.cpp
- Revision:
- 1:3f0c5242bc32
- Parent:
- 0:0ef2fb2bea82
diff -r 0ef2fb2bea82 -r 3f0c5242bc32 main.cpp --- a/main.cpp Fri Nov 15 08:43:15 2019 +0000 +++ b/main.cpp Thu Nov 28 11:50:27 2019 +0000 @@ -6,22 +6,42 @@ Serial pc(USBTX,USBRX); Serial xbee(p13, p14); -int main(void){ + +int main(){ FILE *fp; base64 *bs; int c; - xbee.printf("charizard!!!\r\n"); + xbee.printf("xbee connected!\r\n"); bs = new base64(); - bs->Encode("/local/PICT000.jpg","/local/d.txt"); - + bs->Encode("/local/PICT001.jpg","/local/d.txt"); - if((fp=fopen("/local/d.txt","r"))!=NULL) - { - while ((c=fgetc(fp))!=EOF){ + if((fp=fopen("/local/d.txt","r"))!=NULL) + { + while ((c=fgetc(fp))!=EOF){ xbee.printf("%c",c); + } fclose(fp); - } + } + + while(1) { + + int received_data = xbee.getc(); + + if (received_data == 82 || received_data == 114){ //Rまたはr + xbee.printf("_________________________________________________________________________________________________________________________________\r\n"); + if((fp=fopen("/local/d.txt","r"))!=NULL) + { + while ((c=fgetc(fp))!=EOF){ + xbee.printf("%c",c); //再送 + + } + fclose(fp); + } + } + } + return 0; } +