I'm having problems declaring the variable used in the I2C_read command.
I'm sure it is a simple fix, but I cannot quite get it figured out.
doesWork = i2cDevice.I2C_Read(device.SlaveAddress, memoryAddress, 0, ref theData)
how do I declare theData? The previous read is just trying to read from the default pointer.
Thanks!
I2C read in C#
Moderator: serg
Re: I2C read in C#
You don't need the "ref" keyword and in case of MemoryAddressSize==0 you can pass 0 for the MemoryAddress parameter.
byte[] theData = new byte[32];
doesWork = i2cDevice.I2C_Read(device.SlaveAddress, 0, 0, theData);
For more information see .NET/SUB-20 documentation and C# sample application under SUB-20\sample\.NET\c#
Regards
byte[] theData = new byte[32];
doesWork = i2cDevice.I2C_Read(device.SlaveAddress, 0, 0, theData);
For more information see .NET/SUB-20 documentation and C# sample application under SUB-20\sample\.NET\c#
Regards