예제 #1
0
파일: Button.cs 프로젝트: greendag/Webesto
        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);
        }
예제 #2
0
 public GpioController()
 {
     try
     {
         _gpioController = new GpioSystemController();
         _isSupported    = true;
     }
     catch (NotSupportedException)
     {
         _isSupported = false;
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
파일: Led.cs 프로젝트: greendag/Webesto
 public Led(System.Device.Gpio.GpioController gpioController, int pin) : base(gpioController, pin)
 {
     GpioController.OpenPin(Pin, PinMode.Output);
 }