#include <FastLED.h>
// LED setup
#define LED_PIN 5
#define NUM_LEDS 150
#define ROWS 10
#define COLS 15
CRGB leds[NUM_LEDS];
// Map LEDs for column-major wiring (top to bottom)
int getLEDIndex(int row, int col) {
return (col % 2 == 0) ? (row + col * ROWS) : ((ROWS - 1 - row) + col * ROWS);
}
// Draw Georgian flag
void drawGeorgianFlag(float waveOffset) {
for (int col = 0; col < COLS; col++) {
for (int row = 0; row < ROWS; row++) {
int index = getLEDIndex(row, col);
// Simulate wave effect
float wave = sin((float)row / ROWS * 2.0 * PI + waveOffset);
// Flag pattern: white background with red crosses
if ((col == 7) || (row == 4 || row == 5)) {
leds[index] = CHSV(0, 255, 255); // Red cross
} else {
leds[index] = CHSV(0, 0, 255); // White background
}
// Apply waving brightness effect
leds[index].fadeLightBy(128 * (1 - wave));
}
}
FastLED.show();
}
void setup() {
FastLED.addLeds<WS2811, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.clear();
}
void loop() {
static float waveOffset = 0.0;
drawGeorgianFlag(waveOffset);
waveOffset += 0.1; // Increase wave phase for animation
delay(50);
}