LEDBoard

LEDBoard

new LEDBoard(pins, kwpins, _options)

Source:
Represents a generic LED board or collection of LEDs. The following example turns on all the LEDs on a board containing 5 LEDs attached to GPIO pins 2 through 6.
Example
const LEDBoard = require('gpiozero').LEDBoard;
		var leds = new LEDBoard([2, 3, 4, 5, 6]);
		leds.on();
Parameters:
Name Type Description
pins Array Specify the GPIO pins that the LEDs of the board are attached to. You can designate as many pins as necessary.
kwpins Array Specify an array of arrays that has the Name of the device and the GPIO pins that the LEDs of the board are attached to. You can designate as many pins as necessary.
_options Object Set options for the Collection: * pwm: Default: false, If true, creates PWMLED instances for each pin, else LED. * active_high: Default: true, If true, the on method will set all the associated pins to HIGH. If false, the on method will set all pins to LOW (the `off` method always does the opposite). * initial_value: If false, all LEDs will be off initially, if true the device will be Switched on initialled.

Extends

Methods

active_high() → {boolean}

Source:
Inherited From:
Returns:
Indicates whether the device is active high (true) or low (false).
Type
boolean

close()

Source:
Overrides:
Close all subordinate devices.

is_active() → {boolean}

Source:
Inherited From:
Returns:
- An array of each subordinate devices active state.
Type
boolean

leds() → {Array}

Source:
Inherited From:
Returns:
- A flat array of tuples of all LEDs contained in this collection (and all sub-collections).
Type
Array

length() → {number}

Source:
Inherited From:
Returns:
- The number of subordinate devices.
Type
number

namedtuple() → {Array}

Source:
Inherited From:
Returns:
- An array of subordinate device names.
Type
Array

off()

Source:
Inherited From:
Calls the off method on all child devices within this composite device.

on()

Source:
Inherited From:
Calls the on method on all child devices within this composite device.

toggle()

Source:
Inherited From:
Calls the toggle method on all child devices within this composite device.

value(valueopt) → {Array}

Source:
Inherited From:
When value is undefined then the function returns the value of all child devices as an array. When value is set, all child devices will have their value set according to the value array.
Parameters:
Name Type Attributes Description
value Array <optional>
The value to set all of the child devices to.
Returns:
- The current value of each output device returned as an array.
Type
Array