Download the Arduino IDE and the required libraries:

  1. FastLED
  2. Color Sensor TCS34725

You can pretty much use the attached code as is.

Calling out below a few rows you may consider changing:

1. I used 9 strands of 20 LEDs, total of 180 LEDs. If you use a different amount, change the number in this line of code:

#define NUM_LEDS  180   // Change this to reflect the number of LEDs you have

2. While working on the project the lights might be too bright, If so reduce the number in this line of code. 255 is the max for brightness:

#define BRIGHTNESS  255      // Set Brightness here 255

3. In the setup, the following code makes one of the LEDs blink 3 times to let you know that the color sensor is ready to read a color value. I picked to light up LED #17 since in the way I set up the LEDs that was close to the microcontroller and a bit to the side. Also you can change the color of the blinking light. In my code it goes from Black to White making it blink White.

for (int i=0; i

4. Although I have an MSc in Computer Science I still couldn't follow all of the mathematical computations in the colorwaves() function. What I did find is that if I changed this row the pattern looked more dynamic. If you have any insight on the math, please comment!

 uint8_t msmultiplier = beat8(147); //beatsin88(147, 23, 60);

The rest of the code is pretty much a combination of FastLED sample code and Color Sensor code.

I set it up so that on restart the color sensor reads the color and the skirt fills up with a transition gradient of that color until the next reset. Similar to the Adafruit Chameleon Scarf project. You can also set it up so that it fires off the color sensor every x seconds and changes the lights according to the color it picks up. This can be achieved by moving the code starting from:

tcs.begin(); 

from the setup() function to the loop() function and do some modifications. 

To upload code you need to quickly double press the reset button on the Gemma. You know its uploading if the green and red lights on the Gemma are on.

The images show the testing - one with a red object in front of the color sensor and one with a blue object.

Leave a Reply