// Read a series of bytes from the magnetometer private byte[] readBytesMAG(byte regAddr, int length) { byte[] values = new byte[length]; byte[] buffer = new byte[1]; buffer[0] = (byte)(0x80 | regAddr); I2CACC.WriteRead(buffer, values); // The magnetometer uses the same I2C slave address as the accelerometer return(values); }
// Read a series of bytes from the accelerometer private byte[] readBytesACC(byte regAddr, int length) { byte[] values = new byte[length]; byte[] buffer = new byte[1]; buffer[0] = (byte)(0x80 | regAddr); I2CACC.WriteRead(buffer, values); return(values); }