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
main.cpp
- Committer:
- sebbarpar
- Date:
- 2020-06-20
- Revision:
- 8:36adb37e976d
- Parent:
- 7:9e4e66a8554e
File content as of revision 8:36adb37e976d:
/*
* 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
#define QVGA 76800 //320*240
#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();
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];
ether();
camera.Init('y', QQVGA);
pc.printf("\r\nCamera initiated\r\n");
//Start capturing images in black and white
t.reset();
while(1){
t.reset();
t.start();
camera.CaptureNext();
pc.printf("\r\nDone in %f\r\n",t.read());
while(camera.CaptureDone() == false);
camera.ReadStart();
led1=0;
//wait(1);
for(int x = 0; x<lines; x++){
for(int j=0; j<columns; j++){
camera.ReadOnebyte();
pixel[j]=camera.ReadOnebyte();
//pc.printf("%d", pixel[j]);
}
//sock.sendto("192.168.1.4", 1001, pixel, sizeof(pixel));
//pc.printf("%d", a);
}
//sock.sendto("192.168.1.4", 1001, fin, sizeof(fin));
led1=1;
camera.ReadStop();
wait(1);
}
}