1.1.1 • Published 4 months ago

mountain-displaypad v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

mountain-displaypad

mountain-displaypad is a Node.js library for interfacing with Mountain's 6×2 button Displaypad.

image

❗ Please note that mountain-displaypad is NOT a standalone application. Instead, mountain-displaypad is a code library, which developers can use to make their own applications which interface with the Displaypad.

References

This library is based on infinitton-idisplay, which is a modified version of elgato-stream-deck that does not have dependencies to image libraries, and that talks to the Infinitton device instead of the Elgato Stream Deck.

Install

$ npm install --save mountain-displaypad

Example

const Displaypad = require('./mountain-displaypad')

pad = new Displaypad()

pad.on('up', (key) => {console.log('Button up:', key)})
pad.on('down', (key) => {console.log('Button down:', key)})

pad.clearAllKeys()

pad.fillColor(0, 255,   0,   0)
pad.fillColor(1, 0,   255,   0)
pad.fillColor(2, 0,     0, 255)

// Create a new image with a light red line from the top left to the bottom right corner
image = Buffer.alloc(Displaypad.ICON_SIZE * Displaypad.ICON_SIZE * 3)

for (let i = 0; i < Displaypad.ICON_SIZE; i++) {
    offset = i * Displaypad.ICON_SIZE * 3 + i * 3
    image[offset]   = 0xff
    image[offset+1] = 0x7f
    image[offset+2] = 0x7f
}

pad.fillImage(9, image)

Async example

const Displaypad = require('./mountain-displaypad')

async function main() {
        pad = await Displaypad.openAsync()

        pad.on('up', (key) => {console.log('Button up:', key)})
        pad.on('down', (key) => {console.log('Button down:', key)})

        pad.fillColor(0,255,0,0)
        pad.fillColor(1,0,255,0)
        pad.fillColor(2,0,0,255)
}

main()
1.1.1

4 months ago

1.1.0

4 months ago

1.0.0-1

4 months ago

1.0.0

4 months ago