Пример #1
0
        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);
        }
Пример #2
0
 public UltrasonicSensor(DigitalPort port, IGpioControllerFactory controllerFactory) : base(port, controllerFactory)
 {
     (_echoPin, _triggerPin) = port.ToPinPair();
 }
Пример #3
0
 public UltrasonicSensor(DigitalPort port, IGpioControllerFactory controllerFactory) : base(port, controllerFactory)
 {
     (_echoPin, _triggerPin) = port.ToPinPair();
     _echoReceived           = new ManualResetEvent(false);
     AddToDisposables(_echoReceived);
 }