Class: GPIOPin

gpio~GPIOPin()

A pin of the device. Do not construct new objects, access the pins via gpio.pins[]. The pin numbering for the neonious one is documented in the neonious one documentation. Please refer to it for possible limitations of supported pins.

Constructor

new GPIOPin()

Source:
Fires:

Extends

  • events.EventEmitter

Methods

getType() → {gpio.INPUT|gpio.INPUT_PULLUP|gpio.INPUT_PULLDOWN|gpio.OUTPUT|gpio.OUTPUT_OPENDRAIN}

Returns the type of the pin.
Source:
Returns:
the type
Type
gpio.INPUT | gpio.INPUT_PULLUP | gpio.INPUT_PULLDOWN | gpio.OUTPUT | gpio.OUTPUT_OPENDRAIN

getValue(flagsopt, callback)

Retrieves the level or voltage of the input pin
Parameters:
Name Type Attributes Default Description
flags gpio.DIGITAL | gpio.ANALOG <optional>
gpio.DIGITAL are exact levels requested or shall the voltage be retrieved via ADC?
callback GPIOGetValueCallback the callback called with the level or voltage
Source:

setType(type) → {GPIOPin}

Sets the type of the pin. At program start, all pins are set to INPUT, with exception of the LED pins on neonious ones. These are set to OUTPUT with level 0.
Parameters:
Name Type Description
type gpio.INPUT | gpio.INPUT_PULLUP | gpio.INPUT_PULLDOWN | gpio.OUTPUT | gpio.OUTPUT_OPENDRAIN the type
Source:
Returns:
pin itself, to chain call methods
Type
GPIOPin

setValue(value) → {GPIOPin}

Sets the level of the pin or the pin to PWM with the given duty period if a value between 0 and 1 is given. On neonious one, PWM is implemented with the signal module, so PWM and program defined signals cannot be used at the same time.
Parameters:
Name Type Description
value Number 0 or 1 if a level should be set, a value between 0 and 1 for the duty period of the PWM
Source:
Returns:
pin itself, to chain call methods
Type
GPIOPin