Hi ! I'm currently playing with the NeoMatrix library and i'm searching for an info about irrégular layout of matrices.

In my next project, i want to do a hexagonal layout of 19 leds placed like this (numbers dont care, it's from google images):

How could i represent this in the remap function ? Is there a better method to animate this layout ?

Thx a lot !

Kayrozen

Posts: 4
Joined: Tue Jan 19, 2016 12:33 pm

The matrix library wouldn't support that.

Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Kayrozen

Posts: 4
Joined: Tue Jan 19, 2016 12:33 pm

If there are really 19 NeoPixels in the cluster, you might be able to brute-force a remap function, treating the cells as part of a larger matrix with most of the boxes empty. I use a similar function.
Not a board game...or is it?
HexRemap01.png (6.02 KiB) Viewed 339 times

Then constructing your matrix object as a 9x9 grid, a remap function might look like this.
Code: Select all | TOGGLE FULL SIZE
`// Brute force address conversion, XY to Hex cellsuint16_t hexedGrid01(uint16_t x, uint16_t y) {  y = 9 * y + x;  // Compute index number based on 9x9 matrix  switch(y) {     // Only 19 locations contain a NeoPixel    case 40:      return 0;    case 11:      return 1;    case 36:      return 2;    case 65:      return 3;    case 51:      return 4;    case 26:      return 5;    case 22:      return 6;    case 47:      return 7;    case 69:      return 8;    case 44:      return 9;    case 15:      return 10;    case 29:      return 11;    case 76:      return 12;    case 62:      return 13;    case 33:      return 14;    case 4:      return 15;    case 18:      return 16;    case 54:      return 17;    case 58:      return 18;    default:      return 20;  // Empty matrix location = nonexistent pixel address  }}`
Of course, the number pairs would need to match your pixel arrangement, and of course, only simple functions from the GFX library would be discernible, like a filled circle that spreads from the center or a rectangle wiping downward. Do post a picture if you get it to work. (c:

Hallelujah!
Disciple

Disciple

Posts: 622
Joined: Tue Jan 06, 2015 8:13 pm

WOW ! Great idea. I'll test it this w-e. Thanks a lot.

Kayrozen

Posts: 4
Joined: Tue Jan 19, 2016 12:33 pm

So, it took me a little longer to test this out and it worked ! I changed values to match my led sequence and voilà ! Pic incomming asap.

Thanks a lot to @Disciple for helping me with the brute force remap function.

Kayrozen

Posts: 4
Joined: Tue Jan 19, 2016 12:33 pm