public Button(System.Device.Gpio.GpioController gpioController, int pin, PinMode pinMode = PinMode.InputPullUp) : base(gpioController, pin) { if (pinMode == PinMode.Output) { throw new ArgumentOutOfRangeException(nameof(pinMode), $"{nameof(pinMode)} must be an input type."); } GpioController.OpenPin(Pin, pinMode); GpioController.RegisterCallbackForPinValueChangedEvent(Pin, PinEventTypes.Rising, OnPinRising); GpioController.RegisterCallbackForPinValueChangedEvent(Pin, PinEventTypes.Falling, OnPinFalling); }
public GpioController() { try { _gpioController = new GpioSystemController(); _isSupported = true; } catch (NotSupportedException) { _isSupported = false; } }
private void LedBlinkingNative() { System.Device.Gpio.GpioController controller = new System.Device.Gpio.GpioController(); controller.OpenPin(17); controller.SetPinMode(17, PinMode.Output); while (true) { controller.Write(17, j % 2 == 0); Console.Write(progress[j++ % 4]); System.Threading.Thread.Sleep(100); } }
public Led(System.Device.Gpio.GpioController gpioController, int pin) : base(gpioController, pin) { GpioController.OpenPin(Pin, PinMode.Output); }