Feature Request: Matrix with Zig-Zag supports (32x8 led matrices) #111
dandantsui
started this conversation in
Ideas
Replies: 1 comment 6 replies
-
A sample implementation of a snaked array processor (in C# - my C++ chops are rusty) would be public class ArrFunc
{
public static void Main()
{
var inputchars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
var stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
var outchars = Make2DArray(inputchars, 24, 6);
stopwatch.Stop();
Console.WriteLine($"Array manipulation took {stopwatch.ElapsedMilliseconds} ms");
for(int i = 23; i >= 0; i--)
{
for (int j = 0; j < 6; j++)
{
Console.Write(outchars[i,j] + " ");
}
Console.WriteLine();
}
Console.ReadLine();
}
static T[,] Make2DArray<T>(T[] input, int height, int width, bool reverse = false)
{
T[,] output = new T[height, width];
for (int i = 0; i < height; i++)
{
if(i % 2 == (reverse ? 0 : 1))
{
for (int j = 0; j < width; j++)
{
output[i, j] = input[i * width + j];
}
}
else
{
for (int j = 0; j < width; j++)
{
output[i, width - 1 - j] = input[i * width + j];
}
}
}
return output;
}
} Apologies for the formatting. GH hates me. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Just wanted to request a feature similar to the Adafruit NeoMatrix library to handle zig-zags on LED matrix strips.
Can such be implemented? Would be a great addition for driving wireless-data from Unity.
https://learn.adafruit.com/adafruit-neopixel-uberguide/neomatrix-library
https://www.adafruit.com/product/2294
Beta Was this translation helpful? Give feedback.
All reactions