![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Taking pictures with the OV7670 at 17fps.
Dependencies: ov7670_lib Project_test
Diff: main.cpp
- Revision:
- 9:1c438bd7697d
- Parent:
- 8:36adb37e976d
--- a/main.cpp Sat Jun 20 11:07:07 2020 +0000 +++ b/main.cpp Mon Aug 31 10:13:45 2020 +0000 @@ -1,9 +1,3 @@ -/* - * Author: Edoardo De Marchi - * Date: 07/04/13 - * Notes: OV7670 + FIFO AL422B camera test -*/ - #include "main.h" #include "EthernetInterface.h" #define VGA 307200 //640*480 @@ -11,51 +5,55 @@ #define QQVGA 19200 //160*120 #define lines 120 #define columns 160 -static char format = ' '; -static int resolution = 0; EthernetInterface net; UDPSocket sock; void ether(){ - //net.connect(); + net.connect(); const char *ip = net.get_ip_address(); pc.printf("IP address is: %s\n", ip ? ip : "No IP"); sock.open(&net); } - - int main() { char fin[]="Finished"; - int pixel[160]; - int pix[160]; - //uint_8 p[160]; + char start[]="Start"; + short int pixel[columns+1]; + pc.printf("Lets go"); ether(); camera.Init('y', QQVGA); pc.printf("\r\nCamera initiated\r\n"); //Start capturing images in black and white - t.reset(); + camera.CaptureNext(); + while(1){ t.reset(); t.start(); - camera.CaptureNext(); - pc.printf("\r\nDone in %f\r\n",t.read()); - while(camera.CaptureDone() == false); + //camera.CaptureNext(); + while(camera.CaptureDone() == false); + camera.ReadStop(); camera.ReadStart(); led1=0; - //wait(1); + //Picture starts + sock.sendto("192.168.1.6", 1001, start, sizeof(start)); for(int x = 0; x<lines; x++){ + pixel[0]=x; for(int j=0; j<columns; j++){ camera.ReadOnebyte(); - pixel[j]=camera.ReadOnebyte(); + pixel[j+1]=camera.ReadOnebyte(); //pc.printf("%d", pixel[j]); } - //sock.sendto("192.168.1.4", 1001, pixel, sizeof(pixel)); - //pc.printf("%d", a); + //start capturing next picture while still reading current + if (x==1){ + camera.CaptureNext(); + } + //Send picture line by line + sock.sendto("192.168.1.6", 1001, pixel, sizeof(pixel)); } - //sock.sendto("192.168.1.4", 1001, fin, sizeof(fin)); + //Picture ends + sock.sendto("192.168.1.6", 1001, fin, sizeof(fin)); led1=1; - camera.ReadStop(); - wait(1); + pc.printf("\r\nDone in %f\r\n",t.read()); + //wait(0.4); } } \ No newline at end of file