Exploring the Dome Code

Share on Facebook0Share on Google+0Tweet about this on TwitterPin on Pinterest0Share on Tumblr0

First up: Its final form (until I change it)

“Finished” LED Arrays
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 had already built the LED’s I wanted.

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)

START LOOP
Get information
Do something with that information
END LOOP

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)

LOOP
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
END

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:
update sweeper1
store last_Sweeper_1_Update
store next_Sweeper_1_Update

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:

Semi-organized rats nest
Semi-organized rats nest
Helpful Links:

Breadboard Diagram

Arduino Playground: TLC5940

Share on Facebook0Share on Google+0Tweet about this on TwitterPin on Pinterest0Share on Tumblr0

2 thoughts on “Exploring the Dome Code”

  1. I love how you basically separated one array into 3 and programmatically added “noise” to the “jitter” array. Concise and effective. Keep up the good work!

  2. Thank you very much to share your code, It works for me so good. The only thing, if someone wants to use It, will must to add this one line at the end of the loop void: Tlc.update();

    Thanks again

Leave a Reply

Your email address will not be published. Required fields are marked *