Мы будем признательны за любую информацию.
Код: Выделить всё
#include
#define PIN 6 // Pin where NeoPixel is connected
#define NUMPIXELS 128 // Number of pixels in 8x8 grid * 2
#define GRID_WIDTH 8 // Width of the grid
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Define colors
uint32_t WHITE = pixels.Color(255, 255, 255);
uint32_t YELLOW = pixels.Color(255, 236, 39);
uint32_t MUSTARD = pixels.Color(255, 163, 0);
uint32_t ORANGE = pixels.Color(171, 82, 59);
uint32_t PURPLE = pixels.Color(126, 37, 83);
uint32_t OFF = pixels.Color(0, 0, 0);
// Define an 8x8 color pattern using variables
uint32_t color_pattern[8][8] = {
{OFF, OFF, OFF, ORANGE, OFF, OFF, OFF, OFF},
{OFF, OFF, PURPLE, MUSTARD, PURPLE, OFF, OFF, OFF},
{OFF, PURPLE, MUSTARD, YELLOW, MUSTARD, PURPLE, OFF, OFF},
{ORANGE, MUSTARD, YELLOW, WHITE, YELLOW, MUSTARD, ORANGE, OFF},
{OFF, PURPLE, MUSTARD, YELLOW, MUSTARD, PURPLE, OFF, OFF},
{OFF, OFF, PURPLE, MUSTARD, PURPLE, OFF, OFF, OFF},
{OFF, OFF, OFF, ORANGE, OFF, OFF, OFF, OFF},
{OFF, OFF, OFF, OFF, OFF, OFF, OFF, OFF}
};
int posX = 0; // Initial X position
int posY = 0; // Initial Y position
void setup() {
pixels.begin(); // Initialize NeoPixel library
}
void drawPattern(int offsetX, int offsetY) {
pixels.clear();
for (int y = 0; y < 8; y++) {
for (int x = 0; x < 8; x++) {
int pos1 = (y + offsetY) * GRID_WIDTH + (x + offsetX);
int pos2 = pos1 + 64; // The second grid starts after the first 64 pixels
if (pos1 >= 0 && pos1 < 64) { // Ensure within first grid bounds
pixels.setPixelColor(pos1, color_pattern[y][x]); // Set each pixel to its respective color
}
if (pos2 >= 64 && pos2 < 128) { // Ensure within second grid bounds
pixels.setPixelColor(pos2, color_pattern[y][x]); // Set each pixel to its respective color for the second grid
}
}
}
pixels.show();
}
void loop() {
pixels.setBrightness(40);
drawPattern(posX, posY);
delay(500); // Delay to see movement
// Update position
posX += 1; // Move right
if (posX > GRID_WIDTH - 8) { // If at the right edge, move down and reset X
posX = 0;
posY += 1;
}
if (posY > GRID_WIDTH - 8) { // If at the bottom edge, reset Y
posY = 0;
}
}

Подробнее здесь: https://stackoverflow.com/questions/791 ... nd-showing