画像を2枚撮影
main.cpp
- Committer:
- MatsumotoKouki
- Date:
- 2019-11-25
- Revision:
- 3:6462ae80537b
- Parent:
- 2:7745e694124f
File content as of revision 3:6462ae80537b:
#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; }