private async Task <PCA9685ServoContoller> InitI2cServoController() { var device = await FindI2CDevice(_I2CBus, ServoControllerAddress, I2cBusSpeed.FastMode, I2cSharingMode.Shared); var servoController = new PCA9685ServoContoller(device); return(servoController); }
public SonarCoordinator(PCA9685ServoContoller contoller) { _contoller = contoller; //sensor.ProximityReceived += (sender, args) => _lastReading = args; //sensor.SensorException += (sender, args) => SensorException?.Invoke(this, args); //Pass exceptions from Arduino "sensor" along. _minServoSetting = 250; _maxServoSetting = 800; _contoller.ResetDevice(); _contoller.SetPwmUpdateRate(60); _contoller.SetPwm(PwmChannel.C0, 0, _minServoSetting); Task.Delay(500).Wait(); _currentPosition = _minServoSetting; _arcUnitsPerDegree = (_maxServoSetting - _minServoSetting) / 180d; _stepSize = (int)Math.Floor(_arcUnitsPerDegree * 5); _haveReading = () => true; //_lastReading?.RawValue != default(double); }