11 years, 7 months ago.

i2c talk b/w 11u24 and 1768

I have made the 11u24 a slave as follows:

#include "mbed.h"

DigitalOut myled(LED1);
I2CSlave slave(p28, p27); //configuring Slavery on p28,p27
Serial pc(USBTX, USBRX); // tx, rx


int main() {
   char buf[10];
   slave.address(0xA0);
    while(1) {
        slave.read(buf, 1);
        printf("Read G: %s\n", buf);
    }
}

and I have made the 1768 Master as follows:

#include "mbed.h"


I2C i2c(p28, p27);

const int addr = 0xA0;

int main() {
   char cmd[10];
   cmd[0] = 0x00;
   cmd[1] = 0x01;
    while(1) {
       i2c.write(addr, cmd, 1); 
    }
}

But I see nothing on the serial monitor? what could be the problem?

You do have pull-ups on both lines? And also connected correctly?

You can look at the status the 1768 master returns (the write command returns a value). Then you know if transmission was succesful.

posted by Erik - 26 Apr 2013

1 Answer

11 years, 7 months ago.

its done! solved

Accepted Answer