Skip to content

Instantly share code, notes, and snippets.

@Xayer
Last active February 5, 2020 18:08
Show Gist options
  • Save Xayer/770358e8d8c2c3d5e4f5f1f98be38d3f to your computer and use it in GitHub Desktop.
Save Xayer/770358e8d8c2c3d5e4f5f1f98be38d3f to your computer and use it in GitHub Desktop.
FastLED test code.h
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 300
#define FADE_AMOUNT 5
#define MAX_BRIGHTNESS 255
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
/*leds[0] = CRGB(255, 0, 0);
FastLED.show();
leds[1] = CRGB(255, 0, 0);
FastLED.show();
leds[2] = CRGB(255, 0, 0);
FastLED.show();
leds[3] = CRGB(255, 0, 0);
FastLED.show();
leds[4] = CRGB(255, 0, 0);
FastLED.show();
leds[5] = CRGB(255, 0, 0);
FastLED.show();
leds[6] = CRGB(255, 0, 0);
FastLED.show();
leds[7] = CRGB(255, 0, 0);
FastLED.show();
leds[8] = CRGB(255, 0, 0);
FastLED.show();*/
int red = 255;
int blue = 255;
int green = 255;
int steps = 8;
/* for(int colorIndex = 1; colorIndex < steps; colorIndex++){*/
for(int i = 0; i < sizeof(leds); i++){
//int currentBrightness = (255 / steps) * colorIndex ;
int currentBrightness = 255;
leds[i] = CRGB(0, 0, currentBrightness);
/*if (i >= FADE_AMOUNT){
for(int fadeIndex = 1; fadeIndex < FADE_AMOUNT; fadeIndex++){
int brightness = MAX_BRIGHTNESS / (fadeIndex * 8);
leds[i-fadeIndex] = CRGB(brightness, 0, 0);
}
}*/
FastLED.show();
delay(50);
FastLED.clearData();
}
/*}*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment