Show Posts
Pages: 1 [2] 3 4 5
16  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 09, 2009, 12:17:40 pm
I might be popping this into the wrong thread, but since it's related to the library, I'll start here.

My project has two states - manual & automatic. In order to switch between the two, I have a mini pushbutton. Unfortunately, it's cheap, and bounces like a kid on a trampoline -- usually 3-6 times, depending on how I push it.

The mode is "monitored" by a boolean - 1 or 0, and an interrupt changes the value of it.

Unfortunately, when you trigger the interrupt, it runs it's code, then goes right back to where the program was last running. If it's in the middle of the automatic function, it could take up to 30 seconds before the state change is put into effect (LEDs fade between colors, with a delay(30000) between each fade).

As a "fix" I moved the button from an interrupt to the reset pin, and save the state variable into EEPROM. Then, everytime the arduino is powered off or reset, it switches modes. Personally, I think this method is horribly kludgy, if not "inappropriate."

I suppose I could simply break down the delay segments into 10ms increments, and lump them together in a small loop that watches for a change in the state. But that still doesn't fix the bouncing issue.

My "Perfect Case Scenario" would be that if a user pushes the button, the state is switched, and the main loop() would restart, regardless of where the program currently is.

So, to summarize all of this:
  • How can I debounce an interrupt? (I'm low on physical space, so proper hardware debouncing (using a schmitt trigger) isn't a great option)
  • How can I get the interrupt to literally stop everything and start back at the beginning of the main loop()?

Thanks!
17  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 09, 2009, 10:05:08 am
As far as I know, you can definitely daisy-chain more than 10 5940s.

acleone has a few pics up where he's using 3 of them to drive 16 RGB LEDs (48 total!).

FWIW, I seem to recall seeing that the upper limit was 32 chained chips. Don't quote me on that, though. (I skimmed the thread, but didn't immediately see anything about it)
18  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 07, 2009, 12:20:12 pm
Hey, AC --

Just an aside, updating the playground page would probably be a good idea. There are a LOT of changes that have happened since that was last posted.

If you don't have the time, I could pop in and make the changes. But, I didn't want to "just do it" without passing it by you, first.
19  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 04, 2009, 09:09:07 pm
Awesome! Everything works smiley-grin

Thanks for your efforts, AC!
20  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 03, 2009, 07:43:20 pm
Even playing with the default code, pins 6-13 light up at 100% (or something in that range), and nothing changes.

EDIT: Sorry -- I shuffled things around, and every pin is set to full. I was just blinded by un-diffused LEDs  [smiley=shocked.gif]
21  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 03, 2009, 01:11:02 pm
Awesome. I'll check it out tonight when I get home.

Jury Duty = marginally awesome.

Free day to work on the report for my project, but otherwise, annoying.

And, yes, I know it's my civil duty, blah blah...just bad timing for the gov't to exercise my rights as a citizen.
22  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 03, 2009, 12:45:28 pm
Aah...I missed that. Simple!

And that selected amperage will work "regardless" of the voltage applied to the LEDs? (I know it can only handle up to 17V LED source voltage)
23  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 03, 2009, 11:46:32 am
While we wait to find a solution to the fades mystery, here's another question:

Is the resistor on IRef directly proportional to the resistor value needed to protect the LEDs? 5V, 20mA on a 2.2V LED uses a ~180ohm resistor. We have a 2k resistor plugged in.

Due to poor lighting, and bad eyes, I had a 2.2M resistor on IRef, and blew out my red LEDs (in an RGB led, no less  :'()

How should I calculate the value needed for IRef? I'll be running the arduino and 5940 off of a 5V regulator, and sourcing the LEDs from the wall wart itself. I want to make sure that if someone else builds the kit is able to put in the right resistor, depending on their supply voltage (hopefully, it will be a 6-7V supply, but you never know).
24  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 02, 2009, 11:11:22 pm
Still nothing.

I was about to post another comment saying that p->channel/startValue/whateverelse returns nothing (I'm using serial.println to debug). That makes sense as to why it's always going into the "fade done" portion.

I'm not sure if it's the update function, or the setting of the fade itself, now
25  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: February 02, 2009, 09:50:35 pm
Fades still don't seem to be working. :/

EDIT:
I poked around with the tlc_updateFades() function, and it looks like, for whatever reason, nothing is happening.

currentMillis >= p->endMillis always seems to be true 10 times in a row (only 5 fade buffers) before going to (needsUpdate). I even set my endMillis to current+100000, and it still ended up saying going into the "end fade" portion.

For kicks and giggles, I made it currentMillis <= p->endMillis, and I got the same results, except running the "Else" portion of the statement....with nothing glowing.

All other examples still work, as does my pot-controlled glow sketch.
26  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 30, 2009, 09:08:31 pm
Hey, joe -- I'm just curious: does the Fade demo work on your setup?

I'm confused as all get-out, and can't find anything blatantly wrong in AC's code.
27  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 30, 2009, 10:13:22 am
@Shadow: Awesome Instructable. I'd seen it before and bookmarked it...good to see you're looking to improve it! smiley
28  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 28, 2009, 07:24:00 pm
Confirmed on my end, too. I finally got around to trying all of the examples out. Everything but fades works.
29  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 26, 2009, 10:12:29 pm
Confirmed. I don't see anything happening, either.

I'm going to play around with it a bit more, though.

Edit: I played around with it, but I don't honestly see anything going "wrong".

random() returns long, and TLC_CHANNEL_TYPE is uint8_t, but the compiler doesn't complain about it....I'm stumped (and diving into things far beyond my skill level, too)
30  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: January 26, 2009, 09:59:54 am
Correct me if I'm wrong, but it looks like the fades automatically update themselves, yes?

In the old version, we had to do something like while(tlc.update()) in order to get them to run. This time around, it appears as though you've eliminated that.

If that's the case, what happens if I change the value for a channel that's in the middle of a fade? In other words, if I call tlc.set, will that kill the fade that's already in progress?

(I don't have my hardware in front of me, so I'm just tossing out questions that pop up in my head as I skim the code)
Pages: 1 [2] 3 4 5