I bought a mini maple leaf with the objective of making the C3088 cmos camera interface, I was having trouble with his use i2c peripherals, I connect the SDA and SCL pins of the camera module with pin sda and cells to the maple leaf mini board. I tried to test it using an algorithm which works i2c scanner to scan i2c device addresses that are connected, I scan from address 0 to 127, but the result is leaf maple find all devices of all that address. here is my i2c scanner algorithm:
--------------------------
#include <Wire.h>
#define Serial SerialUSB
void setup()
{
Wire.begin(0,1);
Serial.println("\nI2C Scanner");
while (!SerialUSB.available()) {}
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 0; address < 128; 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("Unknow 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(8000); // wait 8 seconds for next scan
}
--------------------------------------------
Please help me :)
(Edit: I added code layout markup to make it easier to read - gbulmer)