Show Posts
Pages: 1 2 [3] 4 5
31  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 26, 2009, 09:43:30 am
67 seconds? That's a lot.

I won't say I'd "never" use a fade that long...but, never say never, yah?

What I'm doing now shouldn't be more than 1 second, I think.

Once again, you're awesome, ac! If there was an award to hand out to open source contributors, I'd hand you one smiley-wink
But, you definitely earned your merit badge:
Open Source Contributor  ;D
32  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 25, 2009, 12:41:16 pm
Yeah...the fade function would be wonderful.

It looks like the old versions you have posted on your site don't have the fade function, either. I'd hate to use an old version of the library...plus, I'm not even sure i have it around anymore after rebuilding my workstation.
33  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: October 06, 2008, 01:22:51 pm
Quote
nphillips: I didn't see the new reply email until today, sorry!
Not a problem. Life and monetary restrictions have put my project on hold, anyway. It's good to see that you're still interested though!

Quote
(lazy coding in the first place always bites you in the back).
I'm all too familiar with that one.
34  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: October 06, 2008, 09:58:41 am
Good instructable, zervez!

I added a comment regarding the header pin soldering (as coffeebot). I'll keep an eye out for the boards on your site, for sure!
35  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 29, 2008, 03:44:18 pm
Thanks, mikel. I'll give that a go, soon.

it's essentially what I was thinking, but I didn't have the knowledge to build it smiley-wink
36  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 29, 2008, 10:40:41 am
I haven't upgraded yet, myself.

No time to do so, and play around with this lib. acleone, the creator, seems to have "disappeared" for the time being. Apparently, we all get busy around the same time. smiley-wink

I still need to figure out a fix for the millis() issue I noted above.

If I knew anything about what changes were made in IDE 12, and how to update libraries accordingly, I'd lend a hand. Unfortunately, I have no idea how to do it, nor do I currently have the time to try :/
37  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 13, 2008, 11:09:20 am
Once again, I started poking around in the Library...

Code:
if (fp->stopMillis <= currentMillis)

As soon as the arduino's millis counter rolls over, this will get stuck in a 9-hour loop.

I don't have anything off the top of my head right now, but I think a simple for or switch statement to check if the stopMillis is higher than the millis() rollover point.
38  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 13, 2008, 09:52:27 am
Have you run any fades over many hours?

I've been testing a few different wave-like motions, and when I come back to them in the morning, things are either off-sync or "stuck" flickering between two pins. The fade action of each pin seems fine, it's just the timing that breaks.

I thought it might be related to the millis() function, but last night I used a generic "Cylon" sweeper and it ended up stuck flickering between pins 5 and 7.

Here's my crappy code:
Code:
#include <TLC5940LED.h>
int i;
void setup()
{        
      Tlc.init();
      Tlc.resetTimers();
}

void loop()
{
  
  for(i=5;i<14;i+=2)
  {
    Tlc.newFade(i, 1500, 0, 4095);
    Tlc.newFade(i-2,1500,4095,0);
    while(Tlc.updateFades());
  }
 for(i=13;i>2;i-=2)
  {
    Tlc.newFade(i, 1500, 0, 4095);
    Tlc.newFade(i+2, 1500, 4095, 0);
    while(Tlc.updateFades());
  }
}
EDIT: I forgot to add that hitting the reset button gets things back to normal.

And the "stuck" part of the cylon script is, as i said, between i=7 and i=5 on the second half.

This didn't happen with the regular arduino PWM controls. I'm wondering if it's something inside updateFades()
39  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 09, 2008, 11:15:09 pm
Bingo. Thanks.
40  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 09, 2008, 06:56:01 pm
Hmm...finally got around to trying out the Tlc.get() function, but it doesn't compile.

the line of code with the error:
Code:
j = Tlc.get(ledPins[5]);

the error returned:
Code:
o: In function `loop':
undefined reference to `TLC5940LED::get(unsigned char)'
41  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 03, 2008, 04:12:48 pm
Awesome. I don't have my Ardy around either...but I'll certainly give it a whirl tonight!

And, your code isn't horrible, by any means. I once had to debug an entire patchwork content manager written by a 16 year old from the Ukraine. Now, I'm not making fun of the Ukranian Language...but the kid used nothing more than 2-character variable/function/class names, and had maybe 6 comments for 2000+ lines of code. Maybe it made sense in his native tongue, but it didn't make a lick of sense to me. THAT was deserving of points for delving into horrible code!  ;D
42  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 03, 2008, 11:53:52 am
Yet another question, acleone smiley-grin

Is there a way to get the immediate grayscale value of a particular channel?

In your last response, you had mentioned running additional newFade() functions inside the updateFades() while loop. I'd like to experiment with "interactions" between LEDs during the fading process and being able to grab the current value of an LED would be perfect.

Minor Example:
Code:
while(updateFades())
{
    if(getGreyscaleValue(3) > 2048)
    {
        newFade(4, 1000, 1024, 4095);
    }
}

I'll admit, I haven't delved too deeply into the code, so there may be something available I could use, without the need of anything additional. (/me goes off to skim the code as best he can)

EDIT:
Line 243 of TLC5940LED.cpp:
Code:
Tlc.set(fp->channel, fp->endValue - ((((int32_t)(fp->stopMillis - currentMillis)) * fp->dValue) / fp->duration));
That looks like it has what I'd need. Unfortunately, I don't know enough c++ to figure out whether or not I could pull that information from within the sketch itself, or if I would need to write a function for it.

I'm not 100% sure how to use structs, but it does appear that you're incrementing it, as if it's an array of data. If that's the case, it should be pretty easy to build a simple array of integers containing the current values of all active LEDs. Though, for larger numbers of LEDs, this would get fairly memory-intensive.

EDIT 2:
Would something like this work:
Code:
int TLC5940LED::getGreyscaleValue(uint8_t channel)
{
      struct fade *fp = channel;
      return (fp->endValue - ((((int32_t)(fp->stopMillis - currentMillis)) * fp->dValue) / fp->duration));
}
Again, I'm operating at Ignorance Level 10 (of 10). And I know I'm missing error-checking.
43  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 02, 2008, 06:37:08 pm
That worked perfectly, acleone!

Once again, thanks for the amazing library, and quick, helpful responses!

Now, I just need to buy more LEDs...  :o
44  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 02, 2008, 05:36:22 pm
Quote
nphillips:
Code:
(unsigned long)      fadeDelay = millis() + random(5000, 15000);
The last parameter of Tlc.newFade is the start time in millis.  v004 has proper commenting in the examples (sorry)!
Ah hah! I suppose if I paid closer attention to your example, too, it would have been obvious. (testfades002 is what I used to help construct my code)

Quote
Also, if you need to run more than 5 fades at once (if you call newFade more than 5 times before while(Tlc.updateFades())smiley-wink, you need to add more parameters to Tlc.init.  For say 10 fades at once, use Tlc.init(1 tlc, 10 fades).  Tlc.newFade(...) will return false if you have too many fades running at once.
Is there an upper bound to this? Rather, will it break if I try to have it run a boat-load of fades? (I may end up looking at 32+ LEDs for one project....)
45  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: September 02, 2008, 10:23:20 am
Okay...I should have posted this last night, while I had my code in front of me...but I didn't.

I'm trying to get my LEDs to pseudo-randomly fade (intensity, length of fade, and delay until fade). After 2-3 loops, it's as if the timer breaks down. Rather than a series of slow, (sort of) subtle changes, it's a horrendous seizure-inducing strobe effect.

I added some serial output to see the values getting passed, and the values are all a-ok, and the time between loops (checking millis() at the beginning of each) is appropriately spaced. Yet, everything is running at super-speed.

I originally had 6 LEDs running this, but I dropped down to one, just to see what was going on.

my code (as best as I can remember it), without the serial output.
Code:
void setup()
{
    Tlc.init();
    Tlc.resetTimers();
}
void loop()
{
    aLast = a; //our previous intensity
    a = random(0, 4095); //grab our new intensity

    fadeDuration = random(500, 1500); //duration of fade between .5 and 1.5 seconds
    fadeDelay = random(5000, 15000); //delay before fading between 5 and 15 seconds

    Tlc.newFade(3, fadeDuration, aLast, a, fadeDelay);
    while(Tlc.updateFades());
}

So, with that, I get about 2-3 "appropriately" timed fades, before it clicks into strobe mode. I should note, too, that the "strobe mode" appears to be following the code correctly, except that it's almost as if the changes are occurring at 1/100th of the time (i.e. 15000ms becomes 150ms). It's a high-intensity red LED, so I can't stand to look at it for very long, even from the side, especially when it's flickering.
Pages: 1 2 [3] 4 5