Hey, fresh meat here! I´ve just recently discovered Arduino and could use some help. I´m going to have 32 LEDs fading with seperate speeds in a organic way. I´ve been using example codes for some hours now, but the fading is way too rapid. I don´t know how to make a single LED to fade slow and smooth. Can you help me?
Below is the code I´m using right now, testing one LED. How do make the fading slower here?
#include "Tlc5940.h"
#include "tlc_fades.h"
TLC_CHANNEL_TYPE channel;
void setup()
{
Tlc.init();
}
void loop()
{
if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
if (!tlc_isFading(1)){
uint16_t duration = 3000 - (analogRead(0) * 2);
int maxValue = 4000;
uint32_t startMillis = millis();
uint32_t endMillis = startMillis + duration;
tlc_addFade(1, 0, maxValue, startMillis, endMillis);
tlc_addFade(1, maxValue, 0, endMillis, endMillis + duration);
}
if (channel++ == NUM_TLCS * 16) {
channel = 0;
}
}
tlc_updateFades();
}