Here’s an updated version of my FastLED to Processing experiment. Now with the option to draw the pixels in a horizontal, vertical, circular, or matrix layout.
Arduino and Processing sketches here:
EDIT (12/8/15): Note, you need to use Processing version 2.2.1 for this to display properly.
If I can sort out how to make the display work with the newer Processing 3.+ I’ll post an update.
*
cool stuff! I’ve always wanted to have virtual LED strips on my computer so I can program patterns on them and then send them over to the strips (rather than fussing with power and all). I’m wondering how many LEDs you can run over serial though? I’m not sure how high arduino’s baudrate can go but IIRC should be a decent amount, just wondering if youve done the math (or testing) already
I think what would really be cool is if one could code and test entirely on a single machine (mac, windows, linux, whatever), using a graphical representation of the LEDs, then just plop the code on an arduino when it’s done (without having to deal with serial). Unfortunately I suspect that a lot of the library, since its specialized to each microcontorller that has support added, wouldnt be easy to run natively on mac/win/nix. I suppose it wouldnt be too hard to make an implementation that runs on mac/win/nix though, if all youre worried about is visuals (ie you dont have to deal with any of the timing and color correction code). Could probably patch the library with IFDEFs that use graphical output when compiled locally, and then whatever your LED chipset, etc when compiled for your microcontroller…a pipe dream…I guess the other big issue to tackle then is detecting if your program will fill up the memory on arduino…probably hard to do when youre compiling for different platforms… hmm…
don’t mind me, I’m just musing, haven’t slept in >24 hours so my mind runs wild with ideas.
Being able to completely develop and test on a computer would indeed be nice! With this FastLED to Processing setup you still have to always compile/upload to the MCU and then click the Run button in Processing. Would be nice to just “run it” and not have the extra step. But this is still better then needing to carry a physical LED setup and power supply if traveling for example.
My Arduino sketch uses baud 115200, and I’ve just been testing on an UNO. My understanding is that above 115200 on an UNO you can start getting errors. Other setups can go higher though. I just ran across this discussion about baud. http://forum.arduino.cc/index.php/topic,132811.msg999691.html#msg999691
I’m not using a version control system. Well, I am, but it’s just me saving a new version now and then for my own safety of having something to go back to if needed.
@marmil
You’re totally using a version control system, you’re using git – I can tell because you’re using GitHub.
It’s worth learning. Grab yourself a GUI like Git Extensions (if you’re on Windows) or SmartGit (Win/Linux/MacOS) and get a handle on it. You’ll be glad you did.
+Marc Miller I hope you don’t mind I forked your code and added an option for POV (Persistence Of Vision) output for my POV poi. This is particularly handy as previously I had to unplug and swing them around every time just to see a picture.
See here for code with example Arduino POV sketch:
Basically changed the code to receive and show one column at a time. Thanks for sharing!
@marmil , I tried to get this to work and I got errors on both sides. I tried to read through all of your posts. But I couldn’t find step by step directions.
Processing is giving me an error that reads: The size of this sketch could not be determined from your code. Use only numbers (not variables) for size() command. Read the size reference for more details.
I’ve made sure the arduino was running before I had tried to start Processing.
Some but not much. I think the new version of processing doesn’t like size() to have variables which was part of it but now none of the pixels light up after being drawn.
Arduino is 1.0.6 fast led is 3.0.1 I think. No in front of my computer now. 12 pixels and I don’t know what MCU is.
And I’m probably not using the latest Processing. I will need to check on that when I get home next week. The complaining about size() could very well be due to a Processing update. In any case, get the arduino side of it working first.
You might want to delete your old FastLED library and grab the newer release.
@marmil , I check and I am using the most up to date version of FastLED. I’m using an UNO. I’m using arduino IDE 1.6.6 and I’m using 1 row of 12 Leds. After directly entering in an integer for size I was able to get processing to draw the leds but then the leds stay black. I’ve waited a few mins just to make sure they weren’t changing colors slow but nothing happen. Thanks for helping me out. I’ll wait patiently until you get home. I wish you safe travels.
@Keyth_Rodgers I had a look at this again this evening and yes, it doesn’t like the newer Processing 3.+ Totally breaks the display. I hope to fix this, but in the mean time you can grab the older 2.2.1 version (which is what I used at the time) and hopefully it will work for you then. https://processing.org/download/?processing
You can have multiple versions of Processing on your computer and launch whatever one you like. Give it a shot. (For me it seemed like I had to close all windows of one version before trying to open a different version, so just be aware of that.)
Thanks for checking this out. I’ll give it a try tonight. What other Arduino boards does this sketch work for? I was thinking about using it to teach a class to kids.
@marmil , I know it has been some time I hope all is well with you. Thank you again for working on this. I was curious if you could post in the same github location the code that you used to produce this demo. I want to use the matrix code but I’m not 100% sure on how to do it. Having your code would be a great starting place.
Hi @Keyth_Rodgers . Everything shown in the demo was done with the two files linked above. The arduino .ino file was not changed for the different layouts. Only the variables in the Processing file that determine what layout is used (and the number of columns/rows when specifying a matrix layout) were changed. There wasn’t any special matrix code on the arduino side.
For example, to do a 4x3 matrix layout, in the Processing code set these variables:
String layout = “M”;
And enter the correct number for columns and rows:
int numberColumns = 4;
int numberRows = 3;
@marmil , thanks for the response. I was curious have you tested to see if the fadeLightBy(), fadeToBlackBy() or the color math functions work? I honestly think my code might be wrong but I also wanted to check your experience.