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: ov7670_lib Project_test
Revision 9:1c438bd7697d, committed 2020-08-31
- Comitter:
- sebbarpar
- Date:
- Mon Aug 31 10:13:45 2020 +0000
- Parent:
- 8:36adb37e976d
- Commit message:
- Final version
Changed in this revision
--- 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
--- a/main.h Sat Jun 20 11:07:07 2020 +0000 +++ b/main.h Mon Aug 31 10:13:45 2020 +0000 @@ -25,14 +25,3 @@ //RESET extern "C" void mbed_reset(); - -//Serial -char word[25]; -int t1 = 0; -int t2 = 0; -int t3 = 0; - -// -void parse_cmd(); -void CameraSnap(); -void CameraGrab();
--- a/ov7670.lib Sat Jun 20 11:07:07 2020 +0000 +++ b/ov7670.lib Mon Aug 31 10:13:45 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/sebbarpar/code/ov7670_lib/#b1b77891bddf +https://os.mbed.com/users/sebbarpar/code/ov7670_lib/#39ad588f56e5