#include <Adafruit_NeoPixel.h>
#define PIN 5 // GPIO pin connected to LED matrix data input
#define NUMPIXELS 256 // 8 x 32 = 256 LEDs
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Palette of colors inspired by the bamboo forest image
uint32_t palette[] = {
strip.Color(34, 139, 34), // Forest Green
strip.Color(50, 205, 50), // Lime Green
strip.Color(107, 142, 35), // Olive Drab
strip.Color(154, 205, 50), // Yellow Green
strip.Color(85, 107, 47), // Dark Olive Green
strip.Color(189, 183, 107), // Dark Khaki (brownish-yellow)
strip.Color(222, 184, 135), // Burlywood (light brown)
strip.Color(240, 230, 140) // Khaki (yellowish)
};
const int paletteSize = sizeof(palette) / sizeof(palette[0]);
// Background color (dark green)
uint32_t backgroundColor = strip.Color(10, 30, 10);
// Simple 5x7 font for characters used in "CODE BY ARVIND"
const uint8_t font5x7[][5] = {
{0x3E, 0x41, 0x41, 0x41, 0x22}, // C
{0x3E, 0x41, 0x41, 0x41, 0x3E}, // O
{0x7F, 0x41, 0x41, 0x22, 0x1C}, // D
{0x7F, 0x49, 0x49, 0x49, 0x41}, // E
{0x00, 0x00, 0x00, 0x00, 0x00}, // space
{0x7F, 0x49, 0x49, 0x49, 0x36}, // B
{0x07, 0x08, 0x70, 0x08, 0x07}, // Y
{0x7E, 0x11, 0x11, 0x11, 0x7E}, // A
{0x7F, 0x09, 0x19, 0x29, 0x46}, // R
{0x7F, 0x20, 0x10, 0x20, 0x7F}, // V
{0x41, 0x7F, 0x41, 0x00, 0x00}, // I
{0x7F, 0x10, 0x08, 0x04, 0x7F}, // N
{0x7F, 0x41, 0x41, 0x22, 0x1C} // D
};
// Map characters to font index
int charToFontIndex(char c) {
switch (c) {
case 'C': return 0;
case 'O': return 1;
case 'D': return 2;
case 'E': return 3;
case ' ': return 4;
case 'B': return 5;
case 'Y': return 6;
case 'A': return 7;
case 'R': return 8;
case 'V': return 9;
case 'I': return 10;
case 'N': return 11;
// case 'D': return 12;
default: return 4; // space for unknown chars
}
}
const char message[] = "CODE BY ARVIND";
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Cycle through palette colors for the text
for (int colorIndex = 0; colorIndex < paletteSize; colorIndex++) {
drawText(message, palette[colorIndex]);
delay(1500);
}
}
// Draw text on the 8x32 matrix with background color and given text color
void drawText(const char* text, uint32_t textColor) {
int textLength = strlen(text);
int totalWidth = textLength * 6; // 5 pixels + 1 space per char
// Scroll from right to left
for (int offset = 0; offset < totalWidth + 32; offset++) {
fillColor(backgroundColor); // Fill background
for (int i = 0; i < textLength; i++) {
int charIndex = charToFontIndex(text[i]);
int xPos = 32 - offset + i * 6;
if (xPos < -5 || xPos >= 32) continue;
for (int col = 0; col < 5; col++) {
uint8_t colData = font5x7[charIndex][col];
for (int row = 0; row < 7; row++) {
if (colData & (1 << row)) {
int pixelX = xPos + col;
int pixelY = row;
if (pixelX >= 0 && pixelX < 32 && pixelY >= 0 && pixelY < 8) {
int pixelIndex = pixelY * 32 + pixelX;
strip.setPixelColor(pixelIndex, textColor);
}
}
}
}
}
strip.show();
delay(100);
}
}
// Fill the entire matrix with one color
void fillColor(uint32_t color) {
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, color);
}
strip.show();
}
Loading
esp32-s3-devkitc-1
esp32-s3-devkitc-1
https://wokwi.com/projects/new/esp32-s3
https://wokwi.com/projects/463068950445342721