我建造了这个 LED 灯项目,我将 126 个带有 ws2812B LED 的乒乓球放入玻璃花瓶中。在此之前,我对 fastled 没有任何了解。球都乱七八糟了,发光二极管不再有明显的顺序。在代码中,我创建了一个 3d 数组,通过在花瓶外部贴上一个网格并使用内置电位器选择每个 LED 并从串行监视器读取 LED 编号,我为每个 LED 在矩阵中分配了一个位置。所以我现在有了这个 3d 数组
int led_zyx[3][7][13] =
{
{ {92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92},
{92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92},
{78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78},
{65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65},
{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40},
{24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
},
{
{124, 124, 124, 124, 110, 119, 119, 116, 116, 108, 108, 108, 117},
{92, 89, 89, 107, 104, 104, 110, 116, 105, 108, 108, 106, 106},
{85, 84, 84, 77, 98, 82, 97, 97, 75, 92, 91, 85, 85},
{34, 73, 73, 60, 60, 82, 65, 65, 45, 62, 72, 34, 34},
{38, 32, 50, 46, 47, 40, 51, 40, 29, 29, 38, 38, 38},
{0, 17, 17, 46, 25, 25, 31, 31, 10, 29, 23, 23, 23},
{2, 2, 0, 0, 0, 1, 1, 0, 0, 10, 2, 2, 2}
},
{
{113, 118, 114, 109, 125, 115, 121, 120, 120, 123, 112, 112, 117},
{95, 89, 103, 83, 83, 99, 100, 122, 111, 101, 96, 106, 102},
{84, 94, 81, 80, 83, 88, 79, 70, 87, 86, 96, 90, 93},
{74, 67, 55, 68, 76, 56, 69, 57, 61, 71, 58, 63, 74},
{54, 49, 26, 37, 42, 41, 36, 43, 52, 44, 33, 59, 66},
{18, 19, 13, 20, 25, 25, 21, 30, 22, 35, 39, 33, 27},
{14, 8, 3, 9, 4, 4, 12, 16, 5, 11, 15, 28, 7}
},
};
所以我已经设法创建了各种类似的酷模式——除了使用灯/花瓶的外部作为 XY 矩阵在其上绘制动画。这将是一个舒适的 13x7 像素,但我无法弄清楚如何正确处理它以显示图形、文本或像素动画。
谁能给我一个指示如何解决这个问题?我查看了 XYmatris 和 smartmatrix,但它们要求 LED 以特定的顺序布置 - 而不是我的随机方式。
谢谢您的帮助