Skip to content

Higher level LED methods? #6

@domchristie

Description

@domchristie

The monome protocol specifies that messages for LED rows, columns, and maps target a "quad", i.e. an 8x8 segment with an x/y offset. The webmonome API reflects this, but I'm wondering if we could add some higher level methods to make it easier to set LED states in one call.

For example, in mlr, a single LED tracks the sample's play position. In JavaScript we might track this with an array of 16 items:

let row = [0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0]

To convey is to a device, we have to split the array into two chunks of 8, then call gridLedRow twice with offsets:

let chunks = chunk(row, 8) // [[0,0,0,0,0,0,0,0],[0,0,0,0,0,1,0,0]]
chunks.forEach((chunk, i) => monome.gridLedRow(i * 8, rowNumber, chunk))

I'm wondering if a nicer API might be:

monome.gridLedRow(rowNumber, row)

(and perhaps rename the current methods to gridLedRowQuad, or something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions