Cleaning code

Untitled-1I have a template for the light show which is rebuilt every time the hardware stage is rebuilt. The template includes variables, arrays, and functions that make programming a lot easier.

Declaring the alphabet as individual variables is handy so that I don’t have to keep declaring variables within the program. I can just pick a letter, use it, and reuse it. Declaring arrays make it easier to address the desired LEDs as opposed to addressing them using pin numbers. I have a few basic functions, basically used for turning a group of LEDs on or off, like to turn on all of the red LEDs or turn off the “spotlight” LEDs. I don’t normally program functions that make patterns since the stage has so many things going on now. Functions would prevent me from doing multiple things at a time.

So anyways, I rewrote some functions that takes up less lines, significantly reducing the size of the file, which makes it easier to find things. Some of the new functions combine previous functions. For instance, I had separate functions to turn on or off each row color of LEDs, like AllRedsOn() that would turn on all of the red LEDs, AllRedsOff() would turn them off, etc, etc. I wrote a new function called AllLEDs(int ColorSelect, int State) where I would pass a character (a letter, like ‘R’ for red) that signifies the color and an integer (1 or 0) that indicates whether I want them on or off.

After I did this clean up, I got to work on a new show. It’s another short one, clocking in at 55 seconds. It should be out next week. Stay tuned & thanks for visiting!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s