[][]
My goal was to add the color_sense mechanism, whose code is provided as one of the circuit playground exampes. You can hold a brightly colored object in front of the BlueFruit light sensor, and it will change the neopixels' colors to match the object color. I thought this mechanism was very cool and would be easy to incorporate into the genetic algorithm, since it was working with colors already. I wanted this to be my interactive element- setting the target color yourself by color matching an object, and then letting the genetic algorithm run from there on the other 9 pixels.
I used the color_sense code and changed it so that instead of displaying the sensed color, it outputs the sensed color as a set of rgb values. This way I can then access those values in the genetic algorithm code, and set the target color based on them.
I realized that I had to make a .h header file to access the color_sense functions in a separate sketch. I did some googling about this, and copied the format of the GeneticAlgo.h file provided.
This wasn't working, then I realized circuit playground has a senseColor() function built in. I didn't have to use the entire original color_sense program, just the function.
I copied the gamma color correction from the original file. I wasn't sure exactly what this did or how it worked, though.
I added a call to getColor() in the main GA file, so I now had a color variable from which I could call color.green, color.red... and get the rgb values from it to set the target color.
At this point I realized that I didn't even need a separate color_sense.h file, I could just incorporate this code into the GeneticAlgo.ino and GeneticAlgo.h files. I tried this, but it didn't work.
I stopped here, as the Arduino IDE software started giving me a lot of errors I couldn't decipher or fix, and I wasn't able to connect my BlueFruit anymore.
I was able to achieve the color sensing and the genetic algorithm codes working separately, but my knowledge of C++ was not good enough to successfully combine the two and debug it.
[]