You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have an LED that is not part of my grid and I have offset it in my alternating-matrix. ws281x.setIndexMapping(alt_matrix(75,8));
I have text scrolling great but my issue is my 601st led is just yellow and doesnt respond. I tried to manually adjust the array to fix it and just no luck. Here is my code.
-Thanks great work
const Image = require('canvas').Image;
var fs = require('fs'),
getPixels = require("get-pixels"),
led_lib = require('ledutils'),
Gpio = require('pigpio').Gpio,
ws281x = require('rpi-ws281x-native'),
alt_matrix = require('./alternating-matrix.js'),
canvas = require('rpi-ws281x-canvas').create(75,8),
ctx = canvas.getContext('2d'),
NUM_LEDS = 602,
pixelData = new Uint32Array(NUM_LEDS),
pixelDataArr = new Array(NUM_LEDS);
moving = false;
ws281x.init(NUM_LEDS, {
frequency: 800000, // 800kHz (some LEDs run at 400kHz)
dmaNum: 10, // DMA-number to be used
gpioPin: 12, // GPIO-PIN to use (this is the only one i tested)
invert: 0,
brightness: 100
});
ws281x.setIndexMapping(alt_matrix(75,8));
// ---- trap the SIGINT and reset before exit
process.on('SIGINT', function () { //CLEARS LEDS
ws281x.reset();
process.nextTick(function () { process.exit(0); });
});
console.log("Started");
var i = -55;
ctx.scale(-1, 1);
setInterval(function () {
if(i > 75){ i = -55; }
ctx.fillStyle = 'blue';
ctx.translate(0, 8);
ctx.scale(-1, -1);
ctx.font = 'bold 11px times';
ctx.fillText("Joe is Cool", i, 8, 75);
ctx.fillStyle = '#000000';
ctx.fillRect(-75, 0, 75, 75);
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, 1, 8);
ws281x.render(canvas.toUint32Array());
i++;
}, 24);
alternating-matrix.js
module.exports = function(width, height) {
var map = new Uint16Array((width*height)+1);//One for extra LED offset
for(var i = 0; i<map.length+1; i++) {
var row = Math.floor(i/width), col = i % width ;
if((row % 2) === 0) {
map[i+1] = i;
} else {
map[i+1] = (row+1) * width - (col+1);
}
}
//map[599] = 55;//(width*height)-width+1;
//map[0] = 999;
map[600] = 525;
//map[(width*height)-width-1] = (row+1) * width - (col+1);
console.log(map[524], map[525], map[526]);
console.log(map[600]);
return map;
};
The text was updated successfully, but these errors were encountered:
Hi, I have an LED that is not part of my grid and I have offset it in my alternating-matrix.
ws281x.setIndexMapping(alt_matrix(75,8));
I have text scrolling great but my issue is my 601st led is just yellow and doesnt respond. I tried to manually adjust the array to fix it and just no luck. Here is my code.
-Thanks great work
alternating-matrix.js
The text was updated successfully, but these errors were encountered: