Beispiel #1
0
        public GPIOpinvalue DigitalRead(IPin pin)
        {
            PinValidator.Using(pin).ValidateMode(GPIOpinmode.Input);

            var readData = WiringPi.GPIO.DigitalRead(pin.Number);

            switch (readData)
            {
            case (int)GPIOpinvalue.High:
                return(GPIOpinvalue.High);

            case (int)GPIOpinvalue.Low:
                return(GPIOpinvalue.Low);

            default:
                throw new System.Exception($"Read value not applicable to GPIO pin value");
            }
        }
Beispiel #2
0
 public void DigitalWrite(IPin pin, GPIOpinvalue value)
 {
     PinValidator.Using(pin).ValidateMode(GPIOpinmode.Output);
     WiringPi.GPIO.DigitalWrite(pin.Number, (int)value);
 }