hey EVeryone, i need some help with this code, i am trying to fade some LED's connected to the TLC5940, i want only fade one LED at a time in a random fashion, but what i get is many leds fading in a random fashion. what am i doing wrong.
Please any help will be appreciated.
#include "Tlc5940.h"
#include "tlc_fades.h"
int l = random(0,16);
void setup()
{
Tlc.init();
randomSeed(analogRead(0));
}
void randomled(int m)
{
Tlc.clear();
for (int i=0; i<m; i++)
{
uint16_t duration = 4000;
uint32_t startMillis = millis() + 50;
uint32_t endMillis = startMillis + duration;
tlc_addFade(l, 0, 4096, startMillis, endMillis); // fade in
tlc_addFade(l, 4096, 0, endMillis, endMillis + duration); // fade out
tlc_updateFades();
}
}
void loop()
{
randomled(100);
}