Skip to content

Instantly share code, notes, and snippets.

@neoneomaxim
Last active June 19, 2017 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neoneomaxim/0ad87f73bebf44282024c66f6e984a14 to your computer and use it in GitHub Desktop.
Save neoneomaxim/0ad87f73bebf44282024c66f6e984a14 to your computer and use it in GitHub Desktop.
#include <FastLED.h>
// LED setup
#define Height 125
#define DATA_PIN 4
#define NUM_LEDS 125
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
uint8_t ledBrightness = 85;
#define FRAMES_PER_SECOND 10
CRGB leds[NUM_LEDS];
void setup()
{
delay(3000); // 3 second delay for recovery
// LED Init
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setDither(0);
FastLED.setBrightness(ledBrightness);
FastLED.show();
}
void loop()
{
EVERY_N_MILLIS(100) // falling speed
{
for (int8_t row=Height-1; row>=0; row--)
{
if (leds[(row)] == CRGB(0,0,175))
{
leds[(row)] = CRGB::Black;
if (row < Height-1) leds[(row+1)] = CRGB(0,0,175);
}
}
Fill_Green();
Generat_Pixel();
FastLED.show();
FastLED.delay(1000/FRAMES_PER_SECOND);
}
}
void Fill_Green()
{
for( int fill = 125; fill >100; fill--)
leds[fill] = CRGB::Green;
}
void Generat_Pixel()
{
if (random8(6) == 0 )
{
int8_t GeneratePixel = random8(3);
for (int8_t i =0; i < GeneratePixel ; i++)
{
leds[(i)] = CRGB(0,0,175 );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment