Show / Hide Table of Contents

    Class GpioPin

    Represents a general-purpose I/O (GPIO) pin.

    Inheritance
    Object
    GpioPin
    Implements
    IDisposable
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: System.Device.Gpio
    Assembly: System.Device.Gpio.dll
    Syntax
    public sealed class GpioPin : IDisposable

    Properties

    | Improve this Doc View Source

    DebounceTimeout

    Gets or sets the debounce timeout for the general-purpose I/O (GPIO) pin, which is an interval during which changes to the value of the pin are filtered out and do not generate ValueChanged events.

    Declaration
    public TimeSpan DebounceTimeout { get; set; }
    Property Value
    Type Description
    TimeSpan

    The debounce timeout for the GPIO pin, which is an interval during which changes to the value of the pin are filtered out and do not generate ValueChanged events. If the length of this interval is 0, all changes to the value of the pin generate ValueChanged events.

    | Improve this Doc View Source

    PinNumber

    Gets the pin number of the general-purpose I/O (GPIO) pin.

    Declaration
    public int PinNumber { get; }
    Property Value
    Type Description
    Int32

    The pin number of the GPIO pin.

    Methods

    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Finalize()

    Declaration
    protected void Finalize()
    | Improve this Doc View Source

    GetPinMode()

    Gets the current pin mode for the general-purpose I/O (GPIO) pin. The pin mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.

    Declaration
    public PinMode GetPinMode()
    Returns
    Type Description
    PinMode

    An enumeration value that indicates the current pin mode for the GPIO pin. The pin mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.

    | Improve this Doc View Source

    IsPinModeSupported(PinMode)

    Gets whether the general-purpose I/O (GPIO) pin supports the specified pin mode.

    Declaration
    public bool IsPinModeSupported(PinMode pinMode)
    Parameters
    Type Name Description
    PinMode pinMode

    The pin mode that you want to check for support.

    Returns
    Type Description
    Boolean

    true if the GPIO pin supports the pin mode that pinMode specifies; otherwise false. If you specify a pin mode for which this method returns false when you call SetPinMode(PinMode), SetPinMode(PinMode) generates an exception.

    Read()

    Reads the current value of the general-purpose I/O (GPIO) pin.

    Declaration
    public extern PinValue Read()
    Returns
    Type Description
    PinValue

    The current value of the GPIO pin. If the pin is configured as an output, this value is the last value written to the pin.

    | Improve this Doc View Source

    SetPinMode(PinMode)

    Sets the pin mode of the general-purpose I/O (GPIO) pin. The pin mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.

    Declaration
    public void SetPinMode(PinMode value)
    Parameters
    Type Name Description
    PinMode value

    An enumeration value that specifies pin mode to use for the GPIO pin. The pin mode specifies whether the pin is configured as an input or an output, and determines how values are driven onto the pin.

    Exceptions
    Type Condition
    ArgumentException

    The GPIO pin does not support the specified pin mode.

    Toggle()

    Toggles the output of the general purpose I/O (GPIO) pin if the pin is configured as an output.

    Declaration
    public extern void Toggle()
    | Improve this Doc View Source

    Write(PinValue)

    Drives the specified value onto the general purpose I/O (GPIO) pin according to the current pin mode for the pin if the pin is configured as an output, or updates the latched output value for the pin if the pin is configured as an input.

    Declaration
    public void Write(PinValue value)
    Parameters
    Type Name Description
    PinValue value

    The enumeration value to write to the GPIO pin.

    If the GPIO pin is configured as an output, the method drives the specified value onto the pin according to the current pin mode for the pin.

    If the GPIO pin is configured as an input, the method updates the latched output value for the pin. The latched output value is driven onto the pin when the configuration for the pin changes to output.

    Exceptions
    Type Condition
    InvalidOperationException

    This exception will be thrown on an attempt to write to a pin that hasn't been opened or is not configured as output.

    Events

    | Improve this Doc View Source

    ValueChanged

    Occurs when the value of the general-purpose I/O (GPIO) pin changes, either because of an external stimulus when the pin is configured as an input, or when a value is written to the pin when the pin in configured as an output.

    Declaration
    public event PinValueChangedEventHandler ValueChanged
    Event Type
    Type Description
    PinValueChangedEventHandler

    Implements

    IDisposable

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX