GPIODevice

GPIODevice

new GPIODevice(pin)

Source:
Represents a generic GPIO device and provides the services common to all single-pin GPIO devices (like ensuring two GPIO devices do no share a Pin).
Parameters:
Name Type Description
pin int | Pin The GPIO pin (in BCM numbering) or a instance of Pin that the device is connected to.
Throws:
  • - If pin is 'undefined'
    Type
    GPIOPinMissing
  • - If the pin is already in use by another device
    Type
    GPIOPinInUse

Extends

Methods

close()

Source:
Overrides:
Close the device and remove the pin allocation allowing it to be reused.

closed() → {boolean}

Source:
Returns:
- Is ``true`` is no pin is allocated.
Type
boolean

is_active() → {boolean}

Source:
Overrides:
Returns:
- Is true is the device value is currently set.
Type
boolean

pin() → {undefined|*|int|Pin}

Source:
Returns:
- The Pin that the device is connected to. This will be ``undefined`` if the device has been closed (see the :meth:`close` method). When dealing with GPIO pins, query ``pin.number`` to discover the GPIO pin (in BCM numbering) that the device is connected to.
Type
undefined | * | int | Pin

toString() → {string}

Source:
Returns:
- Description of the device.
Type
string

value() → {int|Boolean}

Source:
Overrides:
Returns:
- Current value of the pin.
Type
int | Boolean