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 8:36adb37e976d, committed 2020-06-20
- Comitter:
- sebbarpar
- Date:
- Sat Jun 20 11:07:07 2020 +0000
- Parent:
- 7:9e4e66a8554e
- Commit message:
- bu
Changed in this revision
diff -r 9e4e66a8554e -r 36adb37e976d Capture_bw.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Capture_bw.lib Sat Jun 20 11:07:07 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/sebbarpar/code/Project_test/#9e4e66a8554e
diff -r 9e4e66a8554e -r 36adb37e976d main.cpp
--- a/main.cpp Mon Apr 06 11:23:49 2020 +0000
+++ b/main.cpp Sat Jun 20 11:07:07 2020 +0000
@@ -5,40 +5,57 @@
*/
#include "main.h"
-
+#include "EthernetInterface.h"
#define VGA 307200 //640*480
#define QVGA 76800 //320*240
#define QQVGA 19200 //160*120
-//FileSystem local("local");
+#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()
-{
-//FILE *wrt=fopen("/local/out.txt","w");
- int pixel[QVGA];
- int pixel2[QVGA];
- camera.Init('y', QVGA);
- pc.printf("\r\nCamera initiated");
- camera.CaptureNext();
- while(camera.CaptureDone() == false);
- camera.ReadStart();
- t1 = t.read_ms();
+{ 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();
- for(int x = 0; x<QVGA; x++)
- {
- pixel[x]=camera.ReadOnebyte();
- //fprintf(fp,"%i", pixel[x]);
- //pixel2[x]=camera.ReadOnebyte();
- //fprintf(fp,"%i/n", pixel2[x]);
- pc.printf("%d ", camera.ReadOnebyte());
+ 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();
- pc.printf("done in %f\r\n",t.read());
- //fclose(fp);
-
+ wait(1);
+ }
}
\ No newline at end of file
diff -r 9e4e66a8554e -r 36adb37e976d main.h
--- a/main.h Mon Apr 06 11:23:49 2020 +0000
+++ b/main.h Sat Jun 20 11:07:07 2020 +0000
@@ -8,19 +8,19 @@
Timer t;
bool new_send = false;
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
-DigitalOut led3(LED3);
-DigitalOut led4(LED4);
+DigitalOut led1(LED1,1);
+DigitalOut led2(LED2,1);
+DigitalOut led3(LED3,1);
+DigitalOut led4(LED4,1);
//Camera
OV7670 camera
(
PTE25,PTE24, // SDA,SCL(I2C / SCCB)
- PTA1,PTC16,PTD2, // VSYNC,HREF,WEN(FIFO)
- PTB23,PTA2,PTC2,PTC3,PTB11,PTB10,PTB3,PTB2, // Ds p18(P0.26),p17(P0.25),p16(P0.24),p15(P0.23),p11(P0.18),p12(P0.17),p14(P0.16),p13(P0.15)
- PTB9,PTC4,PTC17 // RRST,OE,RCLK
+ PTA1,PTD3,PTB11, // VSYNC,HREF,WEN(FIFO)
+ PortC, 0x0F0F, // Ds
+ PTD2,PTC4,PTD1 // RRST,OE,RCLK
);
//RESET
diff -r 9e4e66a8554e -r 36adb37e976d ov7670.lib --- a/ov7670.lib Mon Apr 06 11:23:49 2020 +0000 +++ b/ov7670.lib Sat Jun 20 11:07:07 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/sebbarpar/code/ov7670_lib/#46b8114bb5dd +https://os.mbed.com/users/sebbarpar/code/ov7670_lib/#b1b77891bddf