Ejemplo n.º 1
0
        public void Init(int frequency = 60)
        {
            // SoftwareReset();
            // Task.Delay(5).Wait();

            //SetAllPwm(0, 0);

            _device.WriteAddressByte(MODE2, OUTDRV);
            _device.WriteAddressByte(MODE1, ALLCALL);

            Task.Delay(5).Wait(); // wait for oscillator

            var mode1 = _device.ReadAddressByte(MODE1);

            mode1 = (byte)(mode1 & ~SLEEP);  // wake up (reset sleep)
            _device.WriteAddressByte(MODE1, mode1);

            Task.Delay(5).Wait(); // wait for oscillator

            SetPwmFreq(frequency);

            for (int i = 0; i < 16; i++)
            {
                SetServoPosition(i, SERVO_MIN + ((SERVO_MAX - SERVO_MIN) / 2));
            }
        }
Ejemplo n.º 2
0
 private bool IsCorrectModel() => _device.ReadAddressByte(MPU6050_REG_WHO_AM_I) == 0x68;
Ejemplo n.º 3
0
 public bool GetIsActive()
 {
     return(_device.ReadAddressByte(STATUS_REGISTER) == 1);
 }