-
-
Save franciscospaeth/8503747 to your computer and use it in GitHub Desktop.
// pin definition | |
int data_p[] = {0,1,2,3,4,5,6,7}; | |
int xclock_p = 8; | |
int pclock_p = 9; | |
int href_p = 10; | |
int vsynch_p = 11; | |
// not used int siod = 12; | |
// not used int sioc = 13; | |
int lastPclock = 0; | |
int pclock; | |
int href; | |
int vsynch; | |
byte pixel; | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("started"); | |
// configure data pins as input | |
for (int i = 0; i < 8; i++) { | |
pinMode(data_p[i], INPUT); | |
} | |
// configure rest input pins | |
pinMode(xclock_p, OUTPUT); | |
pinMode(pclock_p, INPUT); | |
pinMode(href_p, INPUT); | |
pinMode(vsynch_p, INPUT); | |
} | |
int control = 0; | |
void loop() { | |
// just take one snapshot (307200 = 600 * 480) {{{ | |
if (control >= 307200) { | |
return; | |
} | |
// }}} | |
digitalWrite(xclock_p, HIGH); | |
//Serial.println("clock written"); | |
vsynch = digitalRead(vsynch_p); | |
href = digitalRead(href_p); | |
pclock = digitalRead(pclock_p); | |
if (vsynch == HIGH) return; | |
if (href == LOW) return; | |
if (!(lastPclock == HIGH && pclock == LOW)) { | |
lastPclock = pclock; | |
return; | |
} else { | |
lastPclock = pclock; | |
} | |
pixel = readByteFromDataInput(); | |
char s[10]; | |
sprintf(s, "%d ", pixel); | |
Serial.println(s); | |
if (control % 640 == 0) { | |
Serial.println(""); | |
} | |
// just take one snapshot {{{ | |
control++; | |
// }}} | |
if (control >= 307200) { | |
Serial.println("finished"); | |
} | |
} | |
byte readByteFromDataInput() { | |
byte result = 0; | |
for (int i = 0; i < 8; i++) { | |
result = result << 1 | digitalRead(data_p[i]); | |
} | |
return result; | |
} |
Hi rafaneri, not really.
Hi - any luck/prgress with the camera ? I am working on it as well.
Francisco thought the camera when you buy 4 pins that can be difficult, but 18 pin more difficult all the complexity of the logic ...
in case of positive feedback you can answer me please ...dimates@hotmail.com
There are very few post of this House for 18 pins, yours is great pity not to have finished ..:
I saw another post is very good:
place this example:
Thanks
I have only the following parts which are OV7670 and Arduino uno board. I wrote my code and I have to cheange the clock function code to either read or write in the registers of the camera"OV7670". But, I can't get any response from the camera.
My code has written as follows:
"Start"
Serial.println("Memory written");
}
void loop()
{
//
// Read the first page in EEPROM memory, a byte at a time
//
Serial.println("eeprom_read_byte, return: ");
Wire.beginTransmission(DEVADDR);
Wire.write(0x0B);
Wire.endTransmission();
Wire.requestFrom(int(DEVADDR), 1);
if (Wire.available()) {
rdata = Wire.read();
}
//return rdata;
Serial.println(rdata, HEX);
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}
void eeprom_write_byte(byte deviceaddress, int eeaddress, byte data)
{
// Three lsb of Device address byte are bits 8-10 of eeaddress
byte devaddr = deviceaddress | ((eeaddress >> 8) & 0x07);
byte addr = eeaddress;
Wire.beginTransmission(devaddr);
Wire.write(int(addr));
Wire.write(int(data));
Wire.endTransmission();
delay(10);
}
"End"
Thank you again and I'm looking for your help.
Regards
Saad Alasmari
salasmari@kacst.edu.sa
Hi Francisco,
Thank you very much for taking the time reading my comments.Recently, I'm testing this code for taking a snapshot too.
If possible I would like to know how to see the image taken by this code?
I look forward to receiving your reply.
best regards,
Albert
thank a lot bosssssssssssss
plz send me a video or working wile to my mail radhakrishna3579@gmail.com or send me in watsappp 9553793579
boss..i need to know how it takes snapshot and how it works?
@franciscospaeth
I would like to know how to view the snapshot taken?
Hello Francisco,
Do you had some advance in the test with this code?