Dear all,
I'm new and currently working with the OV7670 camera. Datasheet for the camera. So I would like to use its SCCB protocol, which the datasheet says it is compatible with standard I2C. Yet, I wasn't able to get it working. I'm using the i2c_scanner code for this. Can anyone help me with what I'm doing wrong? Thanks!
code:
#include <Wire.h>
#include <TimerHelpers.h>
const int XCLK_pin = 9;
void setup()
{
pinMode(XCLK_pin, OUTPUT);
OCR1A = 0;
Timer1::setMode(4, Timer1::PRESCALE_1, Timer1::TOGGLE_A_ON_COMPARE);
Wire.begin();
Serial.begin(9600);
while (!Serial);
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(1000); // wait 1 second for next scan
}
Wiring:
Arduino | Camera
3.3V------------------------3.3V
|
---------RESET
GND------------------------GND
|
---------PWDN
D9--------------------------XCLK
SDA-------------------------SIO_D
SCL-------------------------SIO_C
That's it! I appreciate any help!