#include <Adafruit_NeoPixel.h>
#define PIN 6 // פין DATA
#define NUMPIXELS 16 // שנה לפי מספר הלדים שלך
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// צבעים: כתום, צהוב, לבן, כחול
uint8_t colors[][3] = {
{255, 180, 30}, // כתום
{236, 252, 86}, // צהוב
{248, 250, 235}, // לבן
{141, 212, 247} // כחול
};
void setup() {
strip.begin();
strip.show(); // כיבוי ראשוני
}
void loop() {
for (int c = 0; c < 4; c++) {
uint8_t r = colors[c][0];
uint8_t g = colors[c][1];
uint8_t b = colors[c][2];
showColorStepByStep(r, g, b); // הדלקה הדרגתית
delay(2000); // המתנה כשהכול מואר
if (c == 0) {
blinkForDuration(r, g, b, 5000, 300); // הבהוב בכתום 5 שניות
}
if (c == 3) {
while (true); // עצירה אחרי כחול
}
strip.clear();
strip.show();
delay(500); // מעבר חלק
}
}
void showColorStepByStep(uint8_t r, uint8_t g, uint8_t b) {
for (int i = 0; i < NUMPIXELS; i++) {
strip.setPixelColor(i, strip.Color(r, g, b));
strip.show();
delay(150); // שליטה בקצב ההדלקה
}
}
// הבהוב למשך X מילישניות
void blinkForDuration(uint8_t r, uint8_t g, uint8_t b, unsigned long durationMs, int blinkDelayMs) {
unsigned long startTime = millis();
bool on = false;
while (millis() - startTime < durationMs) {
on = !on;
if (on) {
for (int i = 0; i < NUMPIXELS; i++) {
strip.setPixelColor(i, strip.Color(r, g, b));
}
} else {
strip.clear();
}
strip.show();
delay(blinkDelayMs);
}
}