コード例 #1
0
            static void set(int pin)
            {
                if (PiController == null || PinController == null)
                {
                    return;
                }

                GpioPinConfig?pinStatus = PinController.GetGpioConfig(pin);

                if (pinStatus.IsPinOn)
                {
                    PinController.SetGpioValue(pin, GpioPinMode.Output, GpioPinState.Off);
                    Logger.Log($"Successfully set {pin} pin to OFF.", LogLevels.Green);
                }
                else
                {
                    PinController.SetGpioValue(pin, GpioPinMode.Output, GpioPinState.On);
                    Logger.Log($"Successfully set {pin} pin to ON.", LogLevels.Green);
                }
            }