カメラ 撮影のみ

Dependencies:   mbed JPEGCamera

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "JPEGCamera.h"
00003 
00004 int main() {
00005     JPEGCamera camera(p9, p10); // TX, RX
00006     LocalFileSystem local("local");
00007     Timer timer;
00008     timer.start();
00009     camera.setPictureSize(JPEGCamera::SIZE320x240);
00010 
00011     for (int i = 0; i < 1; i++) {
00012         if (camera.isReady()) {
00013             char filename[32];
00014             sprintf(filename, "/local/pict%03d.jpg",i);
00015             printf("Picture: %s ", filename);
00016             if (camera.takePicture(filename)) {
00017                 while (camera.isProcessing()) {
00018                     camera.processPicture();
00019                 }
00020             } else {
00021                 printf("take picture failed\r\n");
00022             }
00023         } else {
00024             printf("camera is not ready\r\n");
00025         }
00026     }
00027     printf("time = %f\n", timer.read());
00028 }