#include <FastLED.h> //Libreria de WS2812B
#define NUM_LEDS 40 //Cantidad de Leds
#define DATA_PIN 22 //Pin de la tira led
#define COLOR_ORDER GRB //Orden de Colores de la tira led
#define CHIPSET WS2812B //Modelo de la tira led
#define BRIGHTNESS 100 //Brillo de la tira led
#define VOLTS 5 //Voltaje de la tira led
#define MAX_AMPS 450 //Maxima corriente disponible, en Miliamperes
CRGB cancha[NUM_LEDS];
int dot = 0;
void setup() {
//Serial.begin(115200);
//Inicia la tira led
FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(cancha,NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
//Limpia la tira de leds prendidos
FastLED.clear();
FastLED.show();
}
void loop() { //Swirly, twirly effect
for (int dot=0; dot<NUM_LEDS; dot++) {
cancha[dot] = CRGB(0,255 - 4*dot,4*dot);
FastLED.show();
delay(10); //even shorter delay this time
}
//decrements down from end of lights
for (int dot=NUM_LEDS - 1; dot>=0; dot--) {
cancha[dot] = CRGB(4*dot,0,255-4*dot);
FastLED.show();
delay(10); //even shorter delay this time
}
}