![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
array size
main.cpp@0:d49bf1a75d35, 2015-08-22 (annotated)
- Committer:
- rockstar
- Date:
- Sat Aug 22 10:14:05 2015 +0000
- Revision:
- 0:d49bf1a75d35
array size;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rockstar | 0:d49bf1a75d35 | 1 | #include "mbed.h" |
rockstar | 0:d49bf1a75d35 | 2 | #include "JPEGCamera.h" |
rockstar | 0:d49bf1a75d35 | 3 | Serial pc(USBTX,USBRX); |
rockstar | 0:d49bf1a75d35 | 4 | DigitalOut led1(LED1); |
rockstar | 0:d49bf1a75d35 | 5 | DigitalOut led2(LED2); |
rockstar | 0:d49bf1a75d35 | 6 | DigitalOut led3(LED3); |
rockstar | 0:d49bf1a75d35 | 7 | DigitalOut led4(LED4); |
rockstar | 0:d49bf1a75d35 | 8 | DigitalOut signalPin(p25); |
rockstar | 0:d49bf1a75d35 | 9 | char diff; |
rockstar | 0:d49bf1a75d35 | 10 | int main() |
rockstar | 0:d49bf1a75d35 | 11 | { |
rockstar | 0:d49bf1a75d35 | 12 | pc.baud(9600); |
rockstar | 0:d49bf1a75d35 | 13 | JPEGCamera camera(p9, p10); // TX, RX |
rockstar | 0:d49bf1a75d35 | 14 | LocalFileSystem local("local"); |
rockstar | 0:d49bf1a75d35 | 15 | Timer timer; |
rockstar | 0:d49bf1a75d35 | 16 | timer.start(); |
rockstar | 0:d49bf1a75d35 | 17 | pc.printf("Setting SIZE 160X120"); |
rockstar | 0:d49bf1a75d35 | 18 | camera.setPictureSize(JPEGCamera::SIZE160x120); |
rockstar | 0:d49bf1a75d35 | 19 | pc.printf("\nSetting SIZE 160X120 done and Taking reference image\n"); |
rockstar | 0:d49bf1a75d35 | 20 | int i=4; |
rockstar | 0:d49bf1a75d35 | 21 | while(i--){ |
rockstar | 0:d49bf1a75d35 | 22 | if (camera.isReady()) |
rockstar | 0:d49bf1a75d35 | 23 | { |
rockstar | 0:d49bf1a75d35 | 24 | char filename[32]; |
rockstar | 0:d49bf1a75d35 | 25 | sprintf(filename, "/local/image%d.jpg",i); |
rockstar | 0:d49bf1a75d35 | 26 | pc.printf("Picture: %s \r\n", filename); |
rockstar | 0:d49bf1a75d35 | 27 | if (camera.takePicture(filename)) |
rockstar | 0:d49bf1a75d35 | 28 | {while (camera.isProcessing()) camera.processPicture(); |
rockstar | 0:d49bf1a75d35 | 29 | } else pc.printf("take picture failed\n"); |
rockstar | 0:d49bf1a75d35 | 30 | } else pc.printf("camera is not ready\n"); |
rockstar | 0:d49bf1a75d35 | 31 | wait(0.5); |
rockstar | 0:d49bf1a75d35 | 32 | } |
rockstar | 0:d49bf1a75d35 | 33 | //pc.printf("Took IMG_REF\r\n"); |
rockstar | 0:d49bf1a75d35 | 34 | |
rockstar | 0:d49bf1a75d35 | 35 | /*while(pc.readable()==0 && signalPin==0){ |
rockstar | 0:d49bf1a75d35 | 36 | if (camera.isReady()) |
rockstar | 0:d49bf1a75d35 | 37 | { char filename[32]; |
rockstar | 0:d49bf1a75d35 | 38 | sprintf(filename, "/local/PICT.jpg"); |
rockstar | 0:d49bf1a75d35 | 39 | pc.printf("Picture: %s \r\n", filename); |
rockstar | 0:d49bf1a75d35 | 40 | if (camera.takePicture(filename)) |
rockstar | 0:d49bf1a75d35 | 41 | {while (camera.isProcessing()) camera.processPicture(); |
rockstar | 0:d49bf1a75d35 | 42 | } else pc.printf("take picture failed\n"); |
rockstar | 0:d49bf1a75d35 | 43 | }else pc.printf("camera is not ready\n"); |
rockstar | 0:d49bf1a75d35 | 44 | */ |
rockstar | 0:d49bf1a75d35 | 45 | pc.printf("Took PICT\r\n"); |
rockstar | 0:d49bf1a75d35 | 46 | //signalPin=1;} |
rockstar | 0:d49bf1a75d35 | 47 | } |