What is it? Tri-Color Pendulums consists of three pendulums: red, green, and blue. As they move toward one another, they share their colors with one another. For instance, as the red and blue pendulums are brought together they approximate purple from opposite ends of the spectrum. This combining works three ways with all of the pendulums, so when all three are brought together they all glow white. Users can interact with the pendulums by moving any of them or knocking. They can then enjoy a fun light show while learning about how colors interact in the RGB color-space .

How does it work Each joystick contains two potentiometers; one for the x-axis and one for the y-axis. I used the measurements from these top mounted joysticks to determine the relative locations of the lights at the bottom of each pendulum. I spaced each of the joysticks on a sheet of MDF. Each of the joysticks is spaced such that they make an equilateral triangle. In my code, I assigned each joystick a virtual set of base coordinates: (0,0) red, (0,255) green, and (128, ~221) blue. These coordinates map to the physical distances between them. Since Each pendulum is a little more than 2 feet long and the joysticks can bend approximately 30 degrees from center, I made sure to space the joysticks a minimum of two feet apart to avoid collisions. I mapped the values coming in from the potentiometers such that when resting they were at 0 and moving full up was +128 and full down was -128, moving full left was -128 and full right was +128. I then added the value from each potentiometer to its base coordinates to determine its position. Once I had these values, I used the distance formula to determine the distance between each of the lightsâ€™ current positions. I subtracted that value from 255 (so closer results in brighter) and used that as the output for the LEDs. I kept the primary color for each light constant and varied the other two. For example the RGB values for the red light are always (255, XXX, XXX). Since the code is running through this input and output process so fast, the lights appear to fluidly change colors as they interact with one another.

Advertisement