A Segment
represents one or more lights. The number of lights controlled by a segment is determined by the number of lights connected to the segment's pin.
Creates a new Segment
instance.
options
(Object): The options for initializing the segment.pin
(Mixed): The pin for the segment.inverted
(Boolean): Whentrue
,LOW
will be used to turn on the segment instead ofHIGH
.
const segment = new Segment({
pin: 3,
inverted: true
})
Creates a new Segment
instance.
pin
(Mixed): The pin for the segment.
const segment = new Segment(3)
Turns off the segment.
segment.off()
Turns on the segment.
segment.on()
Toggles the current state for the segment. If the segment is on, it will turn off; if the segment is off, it will turn on.
segment.toggle()