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
main.cpp
- Committer:
 - saeichi
 - Date:
 - 2019-11-28
 - Revision:
 - 1:3f0c5242bc32
 - Parent:
 - 0:0ef2fb2bea82
 
File content as of revision 1:3f0c5242bc32:
#include "mbed.h"
#include <stdio.h>
#include <base64.h>
LocalFileSystem local("local");
Serial pc(USBTX,USBRX);
Serial xbee(p13, p14);
int main(){
    FILE *fp;
    base64 *bs;
    int c;
    
    xbee.printf("xbee connected!\r\n");
    bs = new base64();
    bs->Encode("/local/PICT001.jpg","/local/d.txt");
    
        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;
}