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-22
- Revision:
- 9:bfd025b059ab
- Parent:
- 8:36adb37e976d
File content as of revision 9:bfd025b059ab:
/* * 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; int capturing=0; EthernetInterface net; UDPSocket sock; EventFlags signals; Thread h; int capt=0; #define href_en 0x01 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); } void hrefen(){ short int pixel[160]; while(1){ if(capturing){ 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)); capturing=0; } } } void OV7670::HrefHandler(void) { if(capt){capturing=1;} } int main() { char fin[]="Finished"; h.start(hrefen); 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.ReadStart(); camera.CaptureNext(); while(camera.CaptureDone() == false){capt=1;}; capt=0; led1=0; camera.ReadStop(); //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)); }*/ //sock.sendto("192.168.1.4", 1001, fin, sizeof(fin)); led1=1; pc.printf("\r\nDone in %f\r\n",t.read()); wait(1); } }