public UltrasonicSensor(DigitalPort port) : base(port) { (_echoPin, _triggerPin) = port.ToPinPair(); _controller = new GpioController(PinNumberingScheme.Logical); AddToDisposables(_controller); _controller.OpenPin(_echoPin, PinMode.Input); _controller.OpenPin(_triggerPin, PinMode.Output); _controller.Write(_triggerPin, PinValue.Low); _controller.Read(_echoPin); }
public UltrasonicSensor(DigitalPort port, IGpioControllerFactory controllerFactory) : base(port, controllerFactory) { (_echoPin, _triggerPin) = port.ToPinPair(); }
public UltrasonicSensor(DigitalPort port, IGpioControllerFactory controllerFactory) : base(port, controllerFactory) { (_echoPin, _triggerPin) = port.ToPinPair(); _echoReceived = new ManualResetEvent(false); AddToDisposables(_echoReceived); }