8 years, 8 months ago.  This question has been closed. Reason: Duplicate question

I can not use the I2C Class in nRF51-DK(Urgent!!)

I can not use the I2C Class in nRF51-DK.

There is no signal at p6 or p5.

I set the I2C class as like below.

and I call the function that use the I2C members in main().

But when I check the signal at p6 or p5, there are no signal.

<< code >>

  1. #define hksSda p6
  2. #define hksScl p5

I2C i2c(hksSda,hksScl);

void TestDigitalOut(void)

{

char cdData[2];

int iAddr,iCount=0;

int iResult=0;

iAddr=0xa0;

cdData[0]=0;

cdData[1]=0;

i2c.write(iAddr,cdData,1,false);

i2c.read(iAddr+1,cdData,2,true);

}