Example #1
0
 // 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);
 }
Example #2
0
 // 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);
 }
Example #3
0
 // Write a byte to the magnetometer
 private void writeByteMAG(byte regAddr, byte value)
 {
     byte[] values   = new byte[value];
     byte[] WriteBuf = new byte[] { regAddr, value };
     I2CACC.Write(WriteBuf);      // The magnetometer uses the same I2C slave address as the accelerometer
 }
Example #4
0
 // Write a byte to the accelerometer
 private void writeByteACC(byte regAddr, byte value)
 {
     byte[] values   = new byte[value];
     byte[] WriteBuf = new byte[] { regAddr, value };
     I2CACC.Write(WriteBuf);
 }
Example #5
0
 private void MainPage_Unloaded(object sender, object args)
 {
     // Cleanup
     I2CGYR.Dispose();
     I2CACC.Dispose();
 }