Running the Software

Proceed with this step only after the Arduino is programmed, the wiring is completed and the LEDs display the red-green-blue startup sequence.
Launch the Processing IDE. After a moment, you should see a simple gray and white window that looks very similar to the Arduino IDE.

From the File menu, select Sketchbook, which should “roll over” to show Adalight and Colorswirl. Select the latter first: Colorswirl.

Click the Run button near the top-left of the window:
If the Arduino is the first or only serial device on the system, this should start a colorful rainbow of animation on the LEDs.

If this is not what happens, then you’ll need to edit some code. Around line 26, look for this statement:

  myPort = new Serial(this, Serial.list()[0], 115200);

We need to change how the code opens the serial connection to the Arduino. One route is just through trial and error: try Serial.list()[1], then Serial.list()[2], and so forth, re-starting the program each time to see if it works. For a more scientific approach, add one new line of code before running the sketch:


When run, this displays a list of all serial ports or devices. If you know which device or COM port corresponds to the Arduino, you can then change the original line to include this data. For example, it might now read:

  myPort = new Serial(this, "COM6", 115200);

This will be different on every system, so we can’t just tell you what to put there.

Another way to locate the port name: in the Arduino IDE, this is the port you selected in the 
Tools→Serial Port menu before programming the chip.

Once you have Colorswirl working, make note of the change (if any), because the same change will need to be made in the Adalight code.

Moving ahead…

From the File menu, select Sketchbook, then Adalight. If you changed the Colorswirl sketch to find the serial port, make that same change to the Adalight code. Now click the Run button.

Though they’re in a jumbled mess on your desk right now, the LEDs should light up in colors resembling the perimeter of your screen. Move some windows around the edge — you should see the LEDs react to this.

As it runs, the software performs a continual series of screen captures, averaging the pixels in blocks around the perimeter of the screen and issuing the resulting color data to the LEDs. You can hide the preview window and let the sketch continue working in the background. Being capture-based, it’s not tied to any one specific media player, and most anything you can put on your display — MPEG movies, YouTube, games and so forth — can benefit from the effect. It seems to work especially well with the outer space sequences in Cosmos…a bit ironic in that Carl Sagan’s “Spaceship of the Imagination” from this series featured a giant flat screen and mood lighting decades before Philips turned it into a commercial product!

If you plan to arrange the LEDs similarly to our examples — 25 pixels in a ring, 1 pixel gap at the bottom, with the first pixel starting just left of the gap — then nothing more needs to be changed in the software. If using a different layout, you’ll need to make adjustments in the code. You'll find extensive notes in the source code for making this (and other) changes.

Once all the hardware and software is working, it’s time to get crafty and mount the LEDs on the telly…

Last updated on 2015-11-18 at 11.31.33 AM Published on 2012-07-29 at 11.58.37 AM