Esempio n. 1
0
        public static void Main()
        {
            _i2cBus = new I2CBus();
            _mpu = new MPU6050(_i2cBus, MPU6050.AddressLow, 400);

            Debug.Print("Testing device connections...");

            if (_mpu.TestConnection() == false) {
                Debug.Print("Connection failed");
            } else {
                Debug.Print("Initializing device...");

                _mpu.Initialize();

                short accelX, accelY, accelZ;
                short gyroX, gyroY, gyroZ;

                while (true) {
                    _mpu.GetMotion6(out accelX, out accelY, out accelZ, out gyroX, out gyroY, out gyroZ);

                    accelX /= 16384;
                    accelY /= 16384;
                    accelZ /= 16384;

                    gyroX /= 131;
                    gyroY /= 131;
                    gyroZ /= 131;

                    Debug.Print("Accel[" + accelX.ToString() + "," + accelY.ToString() + "," + accelZ.ToString() + "] "
                            + "Gyro[" + gyroX.ToString() + "," + gyroY.ToString() + "," + gyroZ.ToString() + "]");
                }
            }
        }
Esempio n. 2
0
 public I2CDevice(I2CBus bus, ushort address, int clockRate)
 {
     _bus = bus;
     _config = new XI2CDevice.Configuration(address, clockRate);
 }
Esempio n. 3
0
 public I2CDevice(I2CBus bus, ushort address, int clockRate)
 {
     _bus    = bus;
     _config = new XI2CDevice.Configuration(address, clockRate);
 }