raupenkram/RAUPE.ino

42 lines
1.1 KiB
Arduino
Raw Permalink Normal View History

2024-05-24 13:55:46 +00:00
#include <FastLED.h>
#define NUM_LEDS 200
#define DATA_PIN 10
#define LEDTYPE WS2812B
#define DOSERIAL 0
CRGB leds[NUM_LEDS];
int fadeAmount = 2; // Set the amount to fade I usually do 5, 10, 15, 20, 25 etc even up to 255.
int brightness = 50;
int delayTime = 60;
int lowerBound = 10;
int upperBound = 200;
void setup() {
FastLED.addLeds<LEDTYPE, DATA_PIN>(leds, NUM_LEDS);
Serial.begin(9600); //This pipes to the serial monitor
Serial.println("Initialize Serial Monitor");
}
void loop() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::SandyBrown; // Set Color HERE!!!
FastLED.setBrightness(brightness);
}
if (DOSERIAL == 1){
Serial.println(brightness);
Serial.println(fadeAmount);
Serial.println('-');
}
FastLED.show();
// reverse the direction of the fading at the ends of the fade:
if (brightness < lowerBound || brightness > upperBound) {
fadeAmount = -fadeAmount;
}
brightness = brightness + fadeAmount;
delay(delayTime); // This delay sets speed of the fade. I usually do from 5-75 but you can always go higher.
}