Nodes for Matrix creator

Hi everyone,
So I'm pretty decent at coding. I would give myself an honest intermediate level. I've played with Node Red in the past and have built custom nodes for people before. Nothing that was made public. But I've hit a bit of a road block or maybe I'm just missing that one part.
My goal is to create a set of nodes to interact with the sensors and RGBW ring on the Matrix Creator. I have the sensors working, I can pull data and sent issue there.
But the RGBW or "everloop" code is giving me grief. I would like to be able to send a color payload from say a color selector or voice command and change the RGBW's on the board. The board can take in an input message in several structures. But do I need to add a floating variable to allow for message flow or is there another path? Any input would be great. I added the Matrix teams sample code of basic inputs the system uses.

var matrix = require("@matrix-io/matrix-lite");

// Get LED count
console.log("This device has " + matrix.led.length + ' LEDs');

// A single string or object sets all LEDs
// Below are different ways of expressing a color (number values are from 0-255)
matrix.led.set({r:0, g:0, b:255, w:0}); // objects can set white

// LEDs off

// Arrays set individual LEDs
matrix.led.set(['red', 'gold', 'purple', {}, 'black', '#6F41C1', 'blue', {g:255}]);

// Arrays can simulate motion
everloop = new Array(matrix.led.length).fill({});
everloop[0] = {b:100};

  var lastColor = everloop.shift();

Welcome to the forum @odiezapha1

For those that are not familiar with the library you are importing your question does not provide sufficient information. Is it possible for you to ask the question in a way that does not need us to understand that library?

Hey, was finally able to get back into my old account. I can try, so here it goes.
What I'm needing is a general code concept. Scenario: you are using the the UI color picker node from dashboard. That node value is then sent to the node that sends it off to the leds.
How would I go about dropping those values from the picker into the code being sent? My thought is

Var R= (payload:msg "r,0,0,0")
Var G=(payload:msg "0,g,0,0")
Var B=(payload:msg "0,0,b,0")
Var W=(payload:msg"0,0,0,w")
Var colval = "RGBW ("+R+,+G+,+B+,+W+,)";

Matrix.led.set ({R: ,G: ,B: ,W: });

And maybe I'm look at it wrong. But the goal is to take the color variable and have it replace or float the values in the matrix.led.set . I hope explains the problem better.

Another thought was since it can receive such varied input. Maybe using the hex variable instead. then it is only one piece to manage. Rather than 4. But I will be honest, I think that code might be above my knowledge base. I'm always up for learning though. The question is still, how do I grab that input value and move it to the Matrix.led.set (......)?

Please show an example of what the object you want out should be. For example, with an output from the picker node of
what result do you want?

Okay if the input message from the colour picker is set to hex. I think this will end up cleaner in the long run.
So if picker output is

msg:payload : string[6] "dcd2ea"

My output js to trigger the leds needs to look like this.


In that case all you need is

Seriously... I will admit it. I thought to just do that at first. But then I started over thinking it I guess. Thanks for the input and dealing with me. I suck at explaining things in text form.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.