cansat
Dependencies: BMP085 JPEGCamera SDFileSystem mbed
Fork of SaibiCansat2014 by
Revision 5:8a4b2ffa8d71, committed 2014-07-15
- Comitter:
- TakashiSasaki
- Date:
- Tue Jul 15 10:43:04 2014 +0000
- Parent:
- 4:05e46365f442
- Child:
- 6:9824d4e2f29b
- Commit message:
- works for master module.
Changed in this revision
--- a/camera.cpp Tue Jul 15 08:22:19 2014 +0000 +++ b/camera.cpp Tue Jul 15 10:43:04 2014 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #include "JPEGCamera.h" #include "SDFileSystem.h" +#include "camera.h" DigitalOut myled1(LED1); //show successful picture was taken DigitalOut myled2(LED2); //show end of sequence @@ -13,7 +14,9 @@ LocalFileSystem local("local"); #define FILENAME "/sd/pict%03d.jpg" -int main_camera() { + + +int main_camera(int i) { printf("%s\n", __FILE__); //sourcefilename printout printf("start!!\n"); @@ -24,41 +27,44 @@ timer.start(); camera.setPictureSize(JPEGCamera::SIZE320x240); - FILE *fp; - if ((fp==fopen(FILENAME,"wb")) == NULL) ; + //FILE *fp = fopen(FILENAME,"wb"); + //if (fp == NULL) return -1; - for (int i = 0; i < 2; i++) { + //for (int i = 0; i < 2; i++) { if (camera.isReady()) { char filename[32]; - sprintf(filename, "/sd/pict%03d.jpg", i); + 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; + //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; + //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; + //} + //myled2 = 1; //show end of sequence + //wait(2.0); + //myled2 = 0; printf("time = %f\n", timer.read()); - fclose(fp); - exit(1); + //fclose(fp); + //exit(1); + return 0; } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camera.h Tue Jul 15 10:43:04 2014 +0000 @@ -0,0 +1,8 @@ +#ifndef JPEG_CAMERA_H +#define JPEG_CAMERA_H + +class Camera { +}; + +int main_camera(int); +#endif \ No newline at end of file
--- a/main.cpp Tue Jul 15 08:22:19 2014 +0000 +++ b/main.cpp Tue Jul 15 10:43:04 2014 +0000 @@ -2,7 +2,7 @@ #include "SDFileSystem.h" #include "BMP085.h" #include "ADXL345_I2C.h" - +#include "camera.h" SDFileSystem sd(p5, p6, p7, p8, "sd"); @@ -75,8 +75,12 @@ } myled = 0; + int loop_count = 0; + while (1) { - wait(1.5); + loop_count += 1; + + //wait(1.5); //BOSH BMP085 Barometric pressure,temperature measurement accelerometer.getOutput(readings); @@ -108,5 +112,7 @@ //LM35DZ Temperature measurement P20 analog-in6 pc.printf("Temperature :: %f\n",ain_LM35DZ*100); + //take picture + main_camera(loop_count); } } \ No newline at end of file