Controls a 7-segment Sparkfun Serial Display.
var segmentlib = require('display-segment');
var led = segmentlib.use(hardware);
led.brightness(1.0);
led.display(49.99, {
leadingZero: false,
places: 2
});
// LED now displays "49.99"!
Connect VCC and GND to Tessel. Connect SDA and SCL (the I2C) lines to the port you wish to use.
Load the library with var segmentlib = require('display-segment')
.
# segmentlib.use( port )→ SegmentLED
Returns a new SegmentLED object.
# led.clear( [next] )
Clear the segmented LED display.
# led.display( number, [options,] [next] )
Display a four-digit number. If leadingZero
in options is set to false
, no leading zeroes are displayed. If places
in options is set, up to that many decimal places are included.
# led.brightness( value, [next] )
Control the brightness. value
is a float from 0.0 to 1.0.
# led.segment( index, mask, [next] )
Bits 0-6 of the mask
value correspond to the segments counterclockwise from the top of the digit. index
is a value from 0-3
indicating the position of the digit, starting from the left (0).
# led.digit( index, number, [next] )
Set the digit at index
to number
from 0-9.
# led.decimal( mask, [next] )
Bits 0-6 of mask
control the decimal points.
# led.reset( [next] )
Resets the display to factory settings.
# led.on( 'ready' )
The led
object emits the ready
event once it's been fully loaded.
MIT licensed.