画像を2枚撮影
main.cpp@2:7745e694124f, 2019-11-21 (annotated)
- Committer:
- MatsumotoKouki
- Date:
- Thu Nov 21 13:13:26 2019 +0000
- Revision:
- 2:7745e694124f
- Child:
- 3:6462ae80537b
take 2 pictures
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MatsumotoKouki | 2:7745e694124f | 1 | #include "mbed.h" |
MatsumotoKouki | 2:7745e694124f | 2 | #include "JPEGCamera.h" |
MatsumotoKouki | 2:7745e694124f | 3 | |
MatsumotoKouki | 2:7745e694124f | 4 | int main() { |
MatsumotoKouki | 2:7745e694124f | 5 | JPEGCamera camera(p13, p14); // TX, RX |
MatsumotoKouki | 2:7745e694124f | 6 | LocalFileSystem local("local"); |
MatsumotoKouki | 2:7745e694124f | 7 | Timer timer; |
MatsumotoKouki | 2:7745e694124f | 8 | timer.start(); |
MatsumotoKouki | 2:7745e694124f | 9 | camera.setPictureSize(JPEGCamera::SIZE320x240); |
MatsumotoKouki | 2:7745e694124f | 10 | |
MatsumotoKouki | 2:7745e694124f | 11 | for (int i = 0; i < 2; i++) { |
MatsumotoKouki | 2:7745e694124f | 12 | if (camera.isReady()) { |
MatsumotoKouki | 2:7745e694124f | 13 | char filename[32]; |
MatsumotoKouki | 2:7745e694124f | 14 | sprintf(filename, "/local/pict%03d.jpg", i); |
MatsumotoKouki | 2:7745e694124f | 15 | printf("Picture: %s ", filename); |
MatsumotoKouki | 2:7745e694124f | 16 | if (camera.takePicture(filename)) { |
MatsumotoKouki | 2:7745e694124f | 17 | while (camera.isProcessing()) { |
MatsumotoKouki | 2:7745e694124f | 18 | camera.processPicture(); |
MatsumotoKouki | 2:7745e694124f | 19 | } |
MatsumotoKouki | 2:7745e694124f | 20 | } else { |
MatsumotoKouki | 2:7745e694124f | 21 | printf("take picture failed\n"); |
MatsumotoKouki | 2:7745e694124f | 22 | } |
MatsumotoKouki | 2:7745e694124f | 23 | } else { |
MatsumotoKouki | 2:7745e694124f | 24 | printf("camera is not ready\n"); |
MatsumotoKouki | 2:7745e694124f | 25 | } |
MatsumotoKouki | 2:7745e694124f | 26 | } |
MatsumotoKouki | 2:7745e694124f | 27 | printf("time = %f\n", timer.read()); |
MatsumotoKouki | 2:7745e694124f | 28 | } |