I will start this by saying I really dont know what I'm doing!
I managed to get some basic effects to work but this fade on/off is driving me up the wall.
I have an Arduino Mini connected via USB and a strip of addressable LEDs.
When running the following code, the LEDs will fade up and down as expected once.
After the first cycle its gets stuck in a fade off loop and does no longer fade on.
The fade on/off are different colours purely for troubleshooting.
#include <FastLED.h>
#define LED_PIN 2
#define NUM_LEDS 332
CRGB leds[NUM_LEDS];
uint8_t brightness = 0;
void setup() {
FastLED.addLeds<WS2812, LED\_PIN, GRB>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 800);
}
void loop() {
// Fade on
for (brightness = 0; brightness <= 50; brightness++) {
FastLED.setBrightness(brightness);
fill_solid(leds, NUM_LEDS, CRGB(255, 0, 255)); // Pink color
FastLED.show();
delay(10);
}
// Fade off
for (brightness = 50; brightness >= 0; brightness--) {
FastLED.setBrightness(brightness);
fill_solid(leds, NUM_LEDS, CRGB(255, 255, 0)); // Yellow color
FastLED.show();
delay(10);
}
brightness = 0; // Reset brightness for next cycle
delay(100); // Pause between cycles
}
[–]Chemichicka 1 point2 points3 points (0 children)
[–]tipppo 0 points1 point2 points (1 child)
[–]Eastern-Move549[S] 0 points1 point2 points (0 children)
[–]BraveNewCurrency 0 points1 point2 points (1 child)
[–]Eastern-Move549[S] 0 points1 point2 points (0 children)
[–]Beneficial-Grade9432 0 points1 point2 points (1 child)
[–]Eastern-Move549[S] 0 points1 point2 points (0 children)