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
That usually means that your library's .o file is not available in the expected place. See by comparison the EEPROM library, which is in hardware/libraries/EEPROM/EEPROM.o.
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.
Once again, I started poking around in the Library...
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.
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.
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
usually there is a limit for millis(), that's why it wraps around and it's not an issue specific to the TLC5940 library (it's arduino limit). But look around the forums for other solutions to the problem ( i think some ppl, once the millis reaches its limit, count down backwards or something)
"As far as those 3V/80mA Sparkfun vibration motors are concerned, they seem to run fine at 500Hz, ramping up and down smoothly, based on prior experience. Alas, I won't be able to confirm with the TLC5940 for at least two weeks (vacation)."
I've used the TLC5940 to drive motors... a tip that usually emerges is to use diodes to protect the chip from any reverse current from the motors. I've used the tlc5940 with motors with diodes and without, and it never harmed the arduino or tlc5940 but it's good to use as a precaution
Just to clarify, in Arduino 0011, the return value for millis() increments upwards by 1 per millisecond until it reaches 0x20C49B9 (about 9 1/2 hours) and then returns to 0 ("rolls over") and continues upward. In Arduino 0012, the rollover occurs at 0xFFFFFFFF, or about 49 days.
I haven't investigated the library code in particular, but I would suggest replacing
if (fp->stopMillis <= currentMillis)
with
// Version 0011 fix #define ROLLOVER 0x20C49BA if (currentMillis - fp->stopMillis % ROLLOVER < ROLLOVER/2)
or
// Version 0012 fix if (currentMillis - fp->stopMillis < 0x80000000)
I have created a breakout board for this circuit for a more simple and quick build of projects and experiments. Take a look at http://www.instructables.com/id/The_Dawm/ where I have put a short instruction how to solder it together with some pictures. I also refer to your library acleone hope that is alright...
The nice thing of the breakout board is that it is easily connectable after each other creating a lot of outputs fast together with the TLC5940 library
If anyone is interested in a breakout board please mail me or soon look at http://blushingboy.org/ where it will be sold as soon as the page is ready...
nphillips: I didn't see the new reply email until today, sorry! You're right about the 9-hour rollover bug. I'll fix that straight away (lazy coding in the first place always bites you in the back).
As for the problems with 0012, it's because the new millis() function disables interrupts while running. The library uses a few interrupts every time update() is called, so calling millis() right after an update might be the problem. I'll try running a few updates without millis to see if that fixes anything.
I have tested all the examples except the animation one and they all work perfectly with 4 tlc5940 in series and arduino 0012 Alpha. will do some longer tests with the code to see if it starts acting weird since this was just a quick one (uploading checking that it fades correctly and then the next one)
thanks a lot for the updated code. btw some of the examples could need some modifications (in my view) regarding scaling them up to more than one TLC5940. Some of them are but some are not. Like always multiply the variable NUM_TLCS with 16 everywhere and so on. I could take a quick look at it and send you some updated versions if you like to.
edit on a closer look it is only example "testfade02" that needs to be updated to fit multiple TLC5940.