画像を2枚撮影
Diff: main.cpp
- Revision:
- 4:4455e109f7fc
- Parent:
- 3:6462ae80537b
--- a/main.cpp Mon Nov 25 08:11:32 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#include "mbed.h" -#include "JPEGCamera.h" -#include <stdio.h> -#include "base64.h" - -LocalFileSystem local("local"); -Serial pc(USBTX,USBRX); -Serial xbee(p9, p10); - -int main() { - JPEGCamera camera(p13, p14); // TX, RX - LocalFileSystem local("local"); - Timer timer; - timer.start(); - camera.setPictureSize(JPEGCamera::SIZE320x240); - - for (int i = 0; i < 10; i++) { - if (camera.isReady()) { - char filename[32]; - sprintf(filename, "/local/pict%03d.jpg", i); - printf("Picture: %s ", filename); - if (camera.takePicture(filename)) { - while (camera.isProcessing()) { - camera.processPicture(); - FILE *fp; - base64 *bs; - int c; - xbee.printf("xbee connected!\r\n"); - bs = new base64(); - bs->Encode("/local/PICT000.jpg","/local/d.txt"); - if((fp=fopen("/local/d.txt","r"))!=NULL) - - { - while ((c=fgetc(fp))!=EOF){ - xbee.printf("%c",c); - } - fclose(fp); - } - } - }else { - printf("take picture failed\n"); - } - } else { - printf("camera is not ready\n"); - } - wait(60); - } - printf("time = %f\n", timer.read()); - - return 0; -}