top of page
Writer's pictureAnthony- Cartolano

Week of 10/30/23

This week me and Scott focused on the code for the different settings for my jersey frame project. Towards the end of last week, I was able to get the crossfade code example that I found online. I modified it to fade between purple and gold, then I simplified the code to what I need. I then tried to implement the crossfade code into my master code with all the other 4 settings, but that's where the issues began. At first, it was saying that I the setAllStrips function was undefined, even though it worked perfectly fine when it was isolated in it's own code. With the help of Scott, I made every setting it's own void in order to try to define the problem and clean up the code. This worked and the setting was activated when I pressed the 5 button on the IRremote (0x15 in hexadecimal form).

The next problem we ran into was turning it off using the off button. I had run into the issue of the around setting not changing settings or shutting off when it was in the middle of a function, instead it shut off or changed once it had completed a couple rotations around the Neopixel strip. This also happened with the crossfade setting, so and Scott decided to try to fix it. He suggested using an interrupt, which is a line of code that will interrupt whatever setting it occurring and activate the new input. However, we weren't able to do this because I'm using the IRremote library, which would mean we would have to go into the source code of the library and edit in an interrupt ourselves, which would be too complicated and take too much time. We noticed that whenever the button was pushed, the red indicator light on the metro mini lit up, meaning that it was in fact receiving a signal. Eventually we figured out that we could add a command in each loop that reads if the button was pressed, which worked.

The last problem we faced was that the settings where motion is occurring (the around and crossfade settings), after one cycle the strip would freeze and the motion would stop. This problem got very complicated very quickly, and Scott was suggesting some wild ways to get it to work, none of which I really understood. Eventually, we decided that it was easiest to rewrite the crossfade setting ourselves to better understand it, since the one I found online was too complicated to try and figure out. We did this by breaking the fade into steps, using subtraction and division of the hex values of the colors purple and gold to get it to seamlessly fade just like the setting I found online. Once that was all figured out, I started designing the PCB for my frame. I've only added a few components so far, but I have to keep in mind the fact that the IR receiver needs to not be covered by the anodized aluminum plaque in order for it to receive signals.



void led_crossfade(float startRed, float startGreen, float startBlue, float endRed, float endGreen, float endBlue) { delay(100); float Red_Step = (endRed - startRed) / 255; float Blue_Step = (endBlue - startBlue) / 255; float Green_Step = (endGreen - startGreen) / 255; float red = startRed; float blue = startBlue; float green = startGreen; while (true) { for (int i = 0; i < 255; i++) { if (check_ir() == 1) { return (0); } red = red + Red_Step; blue = blue + Blue_Step; green = green + Green_Step; uint8_t converted_red = round(red); uint8_t converted_green = round(green); uint8_t converted_blue = round(blue); for (int i = 0; i < NUMPIXELS; i++) { pixels.setPixelColor(i, pixels.Color(converted_red, converted_green, converted_blue)); pixels.show(); } delay(10); } for (int i = 0; i < 4; i++) { if (check_ir() == 1) { return (0); } delay(500); } for (int i = 0; i < 255; i++) { if (check_ir() == 1) { return (0); } red = red - Red_Step; blue = blue - Blue_Step; green = green - Green_Step; uint8_t converted_red = round(red); uint8_t converted_green = round(green); uint8_t converted_blue = round(blue); for (int i = 0; i < NUMPIXELS; i++) { pixels.setPixelColor(i, pixels.Color(converted_red, converted_green, converted_blue)); pixels.show(); } delay(10); } } }


PCB Design



8 views0 comments

Recent Posts

See All

Comentarios


bottom of page