First up: Its final form (until I change it)
Next, Goals. Goals are good.
I like to always start with the end in mind What did I want these arrays to look like? How did I want them to function? What are the initial hurdles? And most important to a pragmatic problem solver… Do I know enough to get started?
I wanted my arrays to appear independent. This brings up an immediate hurdle. Arduino is a single threaded processor. People have done some AMAZING things with Arduino, but at their core, they are very simple. Here’s what a simple Arduino program looks like: (this is not actual code)
Do something with that information
This repeats until you turn off the device. If I want all of my arrays to appear independent, I’m going to have to fake “threading”. There are a number of ways to do this. Since all of my arrays involve some aspect of time variance, it’s simple enough to make that the base of my loop, and fire off updates to the LEDs when the appropriate (random) amount of time has passed. (still pseudo code)
check the current time
if enough time has passed, update sweeper1
if enough time has passed, update sweeper2
if enough time has passed, update jitter
This will work, except we need to do a couple things if ‘enough time has passed’. In order to continue to make these calculations, we need to store a couple variables. We need to know when each array was last updated, and how much time should pass before the next update. Simple. Each “IF Block” would look more like this:
if enough time has passed:
The current state of the code:
This has obvious organizational issues and things that can be done better, but it works. Quick note for those following along from home: In order to chain and control multiple TLC5940 together, you need to edit your tcl_config header and change the number of chips.
Here’s what the wiring currently looks like: