Hi Everyone,
I am new to the PixelBlaze.
I am glad, I found this very nice and very powerful Lighting Controller.
I did play a bit with PixelBlaze a bit and found it very flexible.
I have few programming questions:
-
How do I run whatever function only once at startup?
It looks like “beforeRender” and “render” sections are running in
an endless loop. “render” itself has a loop for all defined pixels
and “beforeRender” is called once per entire “render” cycle.
Outside this two mail engine functions I can create variable and
functions. But if I want to run say, “init” function only once how
do I do this?
I can create something like “runOnce” flag, set it to “true” and
use something like this in the “beforeRender” function:
if (true == runOnce)
{
runOnce = false
init()
}But is it more elegant and appropriate way to do this?
-
Is it possible to create writable 2-dimentional array?
I was able to create and use static (read only) 2-dimentional array:var colors = array(Color_Array_Size)[nColors] =
[
// R G B
[0xff, 0x00, 0x00], // Red
[0xff, 0x64, 0x00], // Yellow
[0x00, 0xff, 0x00], // Green
[0x00, 0x64, 0xff], // Cyan
[0xff, 0x00, 0x7f], // Purple
[0x00, 0x00, 0xff], // Blue
[0xff, 0xff, 0xff] // White
]
But all my attempts to create writable 2-dimentional array failed
on any attempt to modify any location.
I am trying to create some sort of Frame Buffer.
Maybe it is already exist?
I already created pseudo 2-dimentional array from simple array.
It looks like some Lighting Effects is easier to create by
simply modifying a Frame Buffer and let “beforeRender” + “render”
functions simply to display Frame Buffer with a controlled timing.
PS.
I am not a professional SW developer but rather very experienced EE.
Maybe my thinking is biased to HW implementations vs SW.
Thank you,
- Vitaliy