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: BMP085 JPEGCamera SDFileSystem mbed
Fork of SaibiCansat2014 by
camera.cpp
- Committer:
- TakashiSasaki
- Date:
- 2014-07-18
- Revision:
- 9:3a2d25f4700b
- Parent:
- 6:9824d4e2f29b
File content as of revision 9:3a2d25f4700b:
#include "mbed.h"
#include "FastJpegCamera.h"
#include "SDFileSystem.h"
#include "camera.h"
DigitalOut myled1(LED1); //show successful picture was taken
DigitalOut myled2(LED2); //show end of sequence
DigitalOut myled3(LED3); //show picture take failed
DigitalOut myled4(LED4); //show camera is not ready
//SDFileSystem sd(p5,p6,p7,p8,"sd");
//AnalogIn ain(p15);
LocalFileSystem local("local");
#define FILENAME "/sd/pict%03d.jpg"
int main_camera(int i) {
printf("%s\n", __FILE__); //sourcefilename printout
printf("start!!\n");
JPEGCamera camera(p9, p10); // TX, RX
LocalFileSystem local("local"); //save images on mbed
Timer timer;
timer.start();
camera.setPictureSize(JPEGCamera::SIZE320x240);
//FILE *fp = fopen(FILENAME,"wb");
//if (fp == NULL) return -1;
//for (int i = 0; i < 2; i++) {
if (camera.isReady()) {
char filename[32];
sprintf(filename, FILENAME, i);
printf("Picture: %s ", filename);
myled1 = 1;
if (camera.takePicture(filename)) {
while (camera.isProcessing()) {
camera.processPicture();
}
//myled1 = 1; //show successful picture was taken
//wait(2.0);
//myled1 = 0;
} else {
printf("take picture picture\n");
//myled3 = 1; //show picture take failed
//wait(2.0);
//myled3 = 0;
}
myled1 = 0;
} else {
printf("show camera is not ready\n");
myled4 = 1; //show camera is not ready
wait(2.0);
myled4 = 0;
}
//}
//myled2 = 1; //show end of sequence
//wait(2.0);
//myled2 = 0;
printf("time = %f\n", timer.read());
//fclose(fp);
//exit(1);
return 0;
}
