Begin with I2c

08 Nov 2010

I want to connect mbed with a Saa1064 to pilot digit led.

I have this error

"No instance of overloaded function "mbed::I2C::write" matches the argument list (E304)" in file "/main.cpp" and other errors

Here is my code

 

#include "mbed.h"

I2C i2c(p9, p10);        // sda, scl
//Serial pc(USBTX, USBRX); // tx, rx communication avec le pc

const int addr = 0x70; // define the I2C Address

int main() 
{
    char config[] = {0x17};
    char chiffre[] = {0x3F, 0x06, 0x5B, 0x4F};
    
    i2c.write(addr, config, 8); // config 
    i2c.write(addr, chiffre[0], 8); // write 0 on the first digit led
    i2c.write(addr, chiffre[1], 8); // ... 1
    i2c.write(addr, chiffre[2], 8); // .... 2
    i2c.write(addr, chiffre[3], 8); // ... 3 
}
in the function write lenght is for what? I don't know if it correspond to the lenght of my array chiffre[] or if it is for the lenght of the data (0x06 = 8 bytes)

09 Nov 2010

Ok I think I've found

i2c.write(addr, chiffre, 4)

it transmit all data in one line and the lenght specified the data array lenght