Main Site Documentation

Mistake in ebook section I2C


#1

Guys,

I was comparing the I2C section in the ebook with the driver for the tinyclr relayboard.

In the ebook you see:


              //Create I2C object
              I2CDevice.Configuration con = new I2CDevice.Configuration(0x38, 400);
              I2CDevice MyI2C = new I2CDevice(con);

              //Create transactions
              I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[2];

              //Create write buffer
              byte[] RegisterNum = new byte[1] { 2 };
              xActions[0] = MyI2C.CreateWriteTransaction(RegisterNum);

problem is that CreatWriteTransaction is NOT a method of MyI2C but from I2CDevice, so the code should read:

              
              //Create I2C object
              I2CDevice.Configuration con = new I2CDevice.Configuration(0x38, 400);
              I2CDevice MyI2C = new I2CDevice(con);

              //Create transactions
              I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[2];

              //Create write buffer
              byte[] RegisterNum = new byte[1] { 2 };
              xActions[0] = I2CDevice.CreateWriteTransaction(RegisterNum);

Correct?


#2

Yes correct. The updated book will be online in few minutes…