#include <Adafruit_NeoPixel.h>
#define LED_PIN 0 // change to your preferred pin
#define LED_COUNT 60 // change to the number of LEDs in your strip
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show();
}
bool isIntDivisionValid(int numerator, int denominator) {
return (float)numerator / (float)denominator == numerator / denominator;
}
int Mapeo(int Valor, int Size)
{
return Valor%Size;}
int Move = 0;
void loop() {
// Set parameters for the pattern
int delay_time = 50; // adjust to change the speed of the pattern
int tree_color[] = {0, 255, 0}; // adjust to change the color of the tree
int star_color[] = {255, 255, 0}; // adjust to change the color of the star
int tree_height = 10; // adjust to change the height of the tree
// Analiza todos los pixeles
for(int i = 0; i < strip.numPixels(); i++) {
//Una vez encuentra un pixel que cumple las condiciones hace cosas
if(isIntDivisionValid(i, 20)) { // Draw the star
for (int k = i+Move; k < i+Move+7; k++) // una vez encuentra un pixel valido rellena 7 pixels
{
strip.setPixelColor(Mapeo(k+10, LED_COUNT), star_color[0], star_color[1], star_color[2]);
}
}
strip.show();
// delay(25)
//Delay general entre pixel y pixel analizado
}
delay(200);
strip.clear();
Move++;
}