UNPKG

rpi-sk6812-native

Version:

(raspberry-pi *only*) native bindings to control a strip of WS281x or SK6812 LEDs with node.js

14 lines (12 loc) 339 B
module.exports = function(width, height) { var map = new Uint16Array(width*height); for(var i = 0; i<map.length; i++) { var row = Math.floor(i/width), col = i % width; if((row % 2) === 0) { map[i] = i; } else { map[i] = (row+1) * width - (col+1); } } return map; };