final tweaks

This commit is contained in:
hybris 2022-02-19 10:56:04 +01:00
parent 903e059b4a
commit 41b269abae

View File

@ -1,5 +1,5 @@
#include "FastLED.h" #include "FastLED.h"
#define NUM_LEDS 60 // # of LEDS in the strip #define NUM_LEDS 100 // # of LEDS in the strip
#define DATA_PIN 2 // Output Pin to Data Line on Strip #define DATA_PIN 2 // Output Pin to Data Line on Strip
CRGB leds[NUM_LEDS]; CRGB leds[NUM_LEDS];
@ -11,6 +11,9 @@ void setup() {
void loop() { void loop() {
int hue = get_hue(); int hue = get_hue();
int new_brightness = get_brightness(); int new_brightness = get_brightness();
if (new_brightness < 50) {
new_brightness = 50;
}
for(int i = 0; i < NUM_LEDS; i++ ) for(int i = 0; i < NUM_LEDS; i++ )
{ {
leds[i] = CHSV(hue,255,new_brightness); leds[i] = CHSV(hue,255,new_brightness);
@ -23,12 +26,12 @@ uint16_t gHue = 0;
uint8_t gHueDelta = 1; uint8_t gHueDelta = 1;
int get_hue() { int get_hue() {
gHue += gHueDelta; gHue += gHueDelta;
gHue = gHue % 360; gHue = gHue % 255;
return gHue; return gHue;
} }
int brightness = 0; int brightness = 0;
int fadeAmount = 5; // 5, 10, 15, 20, 25, ..., 255. int fadeAmount = 1; // 5, 10, 15, 20, 25, ..., 255.
int get_brightness() { int get_brightness() {
brightness = brightness + fadeAmount; brightness = brightness + fadeAmount;
if(brightness == 0 || brightness == 255) if(brightness == 0 || brightness == 255)
@ -37,4 +40,3 @@ int get_brightness() {
} }
return brightness; return brightness;
} }