Ejemplo n.º 1
0
        protected ArduinoPin ConfigurePin(int pinNumber, PinMode pinMode, long initialValue = -1)
        {
            ArduinoPin pin = new ArduinoPin();

            pin.PinNumber    = pinNumber;
            pin.Mode         = pinMode;
            pin.InitialValue = initialValue;
            pin.CurrentValue = -1;

            //Check that it doesn't conflict with existing pins
            if (!IsPinCompatible(pin))
            {
                throw new Exception("Cannot configure pin as it is not compatible with existing pins");
            }

            if (Pins == null)
            {
                Pins = new List <ArduinoPin>();
            }
            Pins.Add(pin);

            return(pin);
        }
Ejemplo n.º 2
0
 public bool IsPinCapable(ArduinoPin pin)
 {
     return(IsPinCapable(pin.PinNumber, pin.Mode));
 }