{"id":742,"date":"2022-05-01T19:33:02","date_gmt":"2022-05-01T23:33:02","guid":{"rendered":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/?p=742"},"modified":"2024-02-28T03:10:28","modified_gmt":"2024-02-28T08:10:28","slug":"final-project-documentation-frequency-reactive-led-panel","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/tcwiseman\/final-project-documentation-frequency-reactive-led-panel\/","title":{"rendered":"Final Project Documentation &#8211; Frequency Reactive LED Panel"},"content":{"rendered":"\n<p>Over the last 7 weeks, I have spent lots of time working on finalizing a design of a frequency reactive light panel, and here I have the final results of this project.<a href=\"https:\/\/www.yeezyboostbyadidas.com\/\"><strong>adidas yeezy 700 v3<\/strong><\/a> <a href=\"https:\/\/milosljubicic.com\/nike-air-max-1-ultra-moire-black-white-%E0%B8%A3%E0%B8%B2%E0%B8%84%E0%B8%B2-k.html\"><strong>nike air max 1 ultra moire black white \u0e23\u0e32\u0e04\u0e32<\/strong><\/a> <a href=\"http:\/\/decograsscespedartificial.es\/shampoo-isdin-lambdapil-Mexico-k.html\"><strong>shampoo isdin lambdapil Mexico<\/strong><\/a> <a href=\"https:\/\/mail.joanamedrado.com\/ciorapi-compresivi-pana-la-coapsa-k.html\"><strong>ciorapi compresivi pana la coapsa<\/strong><\/a> <a href=\"https:\/\/swap.saydaleyatkw.com\/content\/scarpe-eleganti-senza-lacci-k.html\"><strong>scarpe eleganti senza lacci<\/strong><\/a> <a href=\"https:\/\/milosljubicic.com\/nike-air-max-1-ultra-moire-black-white-%E0%B8%A3%E0%B8%B2%E0%B8%84%E0%B8%B2-k.html\"><strong>nike air max 1 ultra moire black white \u0e23\u0e32\u0e04\u0e32<\/strong><\/a> <a href=\"https:\/\/comprocochesdedesguace.es\/%D0%B4%D0%B0%D0%BC%D1%81%D0%BA%D0%B8-%D0%BF%D0%B0%D0%BC%D1%83%D1%87%D0%B5%D0%BD-%D1%87%D0%BE%D1%80%D0%B0%D0%BF%D0%BE%D0%B3%D0%B0%D1%89%D0%BD%D0%B8%D0%BA-k.html\"><strong>\u0434\u0430\u043c\u0441\u043a\u0438 \u043f\u0430\u043c\u0443\u0447\u0435\u043d \u0447\u043e\u0440\u0430\u043f\u043e\u0433\u0430\u0449\u043d\u0438\u043a<\/strong><\/a> <a href=\"https:\/\/www.veracert-audit.it\/plavky-chlapec-128nove-k.html\"><strong>plavky chlapec 128nove<\/strong><\/a> <a href=\"https:\/\/katprom-recycling.ru\/j%C3%A1t%C3%A9k-hajsz%C3%A1r%C3%ADt%C3%B3-%C3%A1rukeres%C3%B6-k.html\"><strong>j\u00e1t\u00e9k hajsz\u00e1r\u00edt\u00f3 \u00e1rukeres\u00f6<\/strong><\/a> <a href=\"http:\/\/shahnameh-audio.com\/vans-chima-ferguson-pro-2-port-royale-black-forty-two-skateboard-shop-k.html\"><strong>vans chima ferguson pro 2 port royale black forty two skateboard shop<\/strong><\/a> <a href=\"http:\/\/botekayaks.com\"><strong>jayden daniels jersey<\/strong><\/a> <a href=\"https:\/\/katprom-recycling.ru\/j%C3%A1t%C3%A9k-hajsz%C3%A1r%C3%ADt%C3%B3-%C3%A1rukeres%C3%B6-k.html\"><strong>j\u00e1t\u00e9k hajsz\u00e1r\u00edt\u00f3 \u00e1rukeres\u00f6<\/strong><\/a> <a href=\"https:\/\/www.vip-services.fr\/balenciaga-2017-shoes-k.html\"><strong>balenciaga 2017 shoes<\/strong><\/a> <a href=\"https:\/\/www.vip-services.fr\/balenciaga-2017-shoes-k.html\"><strong>balenciaga 2017 shoes<\/strong><\/a> <a href=\"https:\/\/www.nikeairjordanstoresale.com\/\"><strong>cheap jordan 4<\/strong><\/a><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" data-id=\"748\" src=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-768x1024.jpg\" alt=\"\" class=\"wp-image-748\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-768x1024.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-600x800.jpg 600w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-1152x1536.jpg 1152w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-1536x2048.jpg 1536w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-630x840.jpg 630w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-960x1280.jpg 960w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-225x300.jpg 225w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/7B62A092-59CE-4FE7-A7F3-3343666F3078-scaled.jpg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" data-id=\"747\" src=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-768x1024.jpg\" alt=\"\" class=\"wp-image-747\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-768x1024.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-600x800.jpg 600w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-1152x1536.jpg 1152w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-1536x2048.jpg 1536w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-630x840.jpg 630w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-960x1280.jpg 960w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-225x300.jpg 225w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-scaled.jpg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" data-id=\"746\" src=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-768x1024.jpg\" alt=\"\" class=\"wp-image-746\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-768x1024.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-600x800.jpg 600w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-1152x1536.jpg 1152w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-1536x2048.jpg 1536w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-630x840.jpg 630w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-960x1280.jpg 960w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-225x300.jpg 225w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3322-scaled.jpg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption wp-element-caption\">The final light panel with diffusive cover (left), uncovered (center), and electronics (right)<\/figcaption><\/figure>\n\n\n\n<p>After finalizing the frequency code, I was able to develop <a href=\"http:\/\/botekayaks.com\"><strong>vanhunks kayak<\/strong><\/a> <a href=\"http:\/\/swastikbuilders.com\/adidas-shoes-new-design-k.html\"><strong>adidas shoes new design<\/strong><\/a> <a href=\"https:\/\/nalu-planning.com\/vintage-adidas-womens-sneakers-k.html\"><strong>vintage adidas womens sneakers<\/strong><\/a> <a href=\"https:\/\/agence-sunlight.com\/content\/chia-seeds-benefits-for-women-k.html\"><strong>chia seeds benefits for women<\/strong><\/a> <a href=\"https:\/\/mail.joanamedrado.com\/rochie-plaja-tricotata-cu-gauri-bej-k.html\"><strong>rochie plaja tricotata cu gauri bej<\/strong><\/a> <a href=\"http:\/\/xitem.pk\/adidas-superstar-ii-femme-k.html\"><strong>adidas superstar ii femme<\/strong><\/a> <a href=\"http:\/\/marianalimamakeup.com.br\/%CE%BA%CF%81%CE%B5%CE%B2%CE%B1%CF%84%CE%B9%CE%B1-%CE%BC%CE%BF%CE%BD%CE%B1-%CE%BC%CE%B5-%CE%B1%CF%80%CE%BF%CE%B8%CE%B7%CE%BA%CE%B5%CF%85%CF%84%CE%B9%CE%BA%CE%BF-%CF%87%CF%89%CF%81%CE%BF-%CE%BA%CE%B1%CE%B9-%CF%83%CF%84%CF%81%CF%89%CE%BC%CE%B1-k.html\"><strong>\u03ba\u03c1\u03b5\u03b2\u03b1\u03c4\u03b9\u03b1 \u03bc\u03bf\u03bd\u03b1 \u03bc\u03b5 \u03b1\u03c0\u03bf\u03b8\u03b7\u03ba\u03b5\u03c5\u03c4\u03b9\u03ba\u03bf \u03c7\u03c9\u03c1\u03bf \u03ba\u03b1\u03b9 \u03c3\u03c4\u03c1\u03c9\u03bc\u03b1<\/strong><\/a> <a href=\"http:\/\/kayaksfoldable.com\"><strong>blow up two person kayak<\/strong><\/a> <a href=\"http:\/\/bolneli.ge\/une-sneaker-k.html\"><strong>une sneaker<\/strong><\/a> <a href=\"http:\/\/colegiotendencia.com.br\/vans-sandals-australia-k.html\"><strong>vans sandals australia<\/strong><\/a> <a href=\"https:\/\/parveenroadways.com\/workout-spandex-shorts-k.html\"><strong>workout spandex shorts<\/strong><\/a> <a href=\"https:\/\/www.madaonline.it\/cazadora-estilo-motero-hombre-k.html\"><strong>cazadora estilo motero hombre<\/strong><\/a> <a href=\"http:\/\/greenitexpo.com\/mug-bedrucken-amazon-k.html\"><strong>mug bedrucken amazon<\/strong><\/a> <a href=\"http:\/\/www.smegroup.it\/amazon-goldkette-24-karat-herren-k.html\"><strong>amazon goldkette 24 karat herren<\/strong><\/a> <a href=\"https:\/\/warnerswheels.com\/westerm-kalap-k.html\"><strong>westerm kalap<\/strong><\/a>a fully operational system that reacts based on frequency readings of any sound recieved by the microphone sensor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lights and Sensors<\/h2>\n\n\n\n<p>Most of the light and sensor programing came easily after finalizing my frequency reading program. One of my trickiest problems was managing my code to allow for frequency detection while also allowing those frequencies to dictate which functions would be run correctly. During my time coding the sensors, I needed to identify several reasons as to why my code would not process a frequency system. After several adjustments, I eventually was able to make the code work successfully, and it would allow for the various lights to succeed. <\/p>\n\n\n\n<p>Following this, I decided to focus on programming my LEDs to use sevaral itterations of code and tested them in several sequences. All code libraries and programs used in this project, and modified variants can be found in the link <a href=\"https:\/\/www.tweaking4all.com\/hardware\/arduino\/adruino-led-strip-effects\/\" data-type=\"URL\" data-id=\"https:\/\/www.tweaking4all.com\/hardware\/arduino\/adruino-led-strip-effects\/\">here<\/a>. For my final code, I used five functions: an Red, Green, Blue fade in and fade out system, a random color appear and disappear circuit, a meteor trail system that flows light in one direction similar to a meteor trail, and a cyclon style pattern with a random color selected, and a custom burst circuit that utilizes parts of the fade code. Each function was set to run based on a frequency heard between 300hz and 700hz. Below is a demonstration of the LEDs and programs utilized before installation on the final project board<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3297.mov\"><\/video><figcaption class=\"wp-element-caption\">Video displaying the LED strips reacting based on a frequency generator<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Final Product<\/h2>\n\n\n\n<p>After finalizing my code, I was able to get my code into a usable state and attached everything to a piece of posterboard and stood it up with other pieces cut from the same board. Everything was tested with the microphone sensor and succeeded in running the code based on any frequency heard As for a light diffuser, I did not have enough time to get any additional material, so I had to utilize a white plastic bag as the diffuser as it was enough to diffuse light effectively, and was also very useful as a carrying case when not in use. Below is a demonstration of the final product without the cover and with the cover. <\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3319.mov\"><\/video><figcaption class=\"wp-element-caption\">Light Board without Cover<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3318_Trim.mp4\"><\/video><figcaption class=\"wp-element-caption\">Light Board with Cover<\/figcaption><\/figure>\n\n\n\n<p>After enough work, I was able to deduct that whistling would be the best course of action for showing how the device works, as it is easier to reach certain pitches. However, it is still difficult to get a specific frequency to be noticed by the device with only whistling, and it is best to use a frequency generator to get an exact function. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thoughts and Revisons<\/h2>\n\n\n\n<p>After lots of time and effort, the project did succeed, but there is still plenty I wanted to do. For example, I wanted to use this code with other pieces, but these eventually failed as it led to LED issues that would freeze the code and reset the loop earlier than planned. For the project to succeed, I had to only utilize five programs listed as the flash memory of my project was limited due to a mass amount of global variables and several arrays. Additionally, I wanted to make it so that each light strip used could run it&#8217;s own individual program. However, this was also something I couldn&#8217;t complete due to limitations of the Arduino microcontroller&#8217;s flash memory of only 2GB. Due to this, I could not create additional independent arrays without creating more issues for the code, so I had to utilize a linked system to complete this process. Given this, in the future I would prefer to use a microcontroller with a larger amount of flash memory to allow for individual array control. And with that, this brings the end of my final project. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n\n<p><strong>Primary Code<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Tyson Wiseman - HUA3901 Practicum - Light Art D term\n\n   Final Project Room: FLA17\n\n   Code: Sound Reactive Light Circuit\n\n   Libraries used:\n    arduinoFFT.h\n    FastLED.h\n    meteorTrail\n    cyclon\n\n\n    Various custom programs:\n\n    Burst\n    Random Rainbow\n\n    This project was originally supposed to use multiple arrays for variable control of the LED strips\n    Unfortunately, due to the dynamic memory constraints, I needed to reduce how many arrays existed. The result is the current model.\n\n    For future reference, if I want to control a 7x7 board and be able to program each individual strip unlinked, then I would need more dynamic memory.\n\n*\/\n\n\n\/\/sound code initialization\n#include &lt;arduinoFFT.h&gt;\n\n#define SAMPLES 128 \/\/samples-pt FFT\n#define SAMPLING_FREQUENCY 2048 \/\/Ts = Based on Nyquist\n\narduinoFFT FFT = arduinoFFT();\n\nunsigned int samplingPeriod;\nunsigned long microSeconds;\n\ndouble vReal&#091;SAMPLES]; \/\/vector of size SAMPLES to hold real vals\ndouble vImag&#091;SAMPLES]; \/\/ vector of size SAMPLES to hold imaginary values\n\ndouble peak;\n\n\/\/LED strip initalization\n\n#include &lt;FastLED.h&gt;\n\n\n\/\/define LED Strips\n#define LED0        2\n#define LED1        3\n#define LED2        4\n#define LED3        5\n#define LED4        6\n#define LED5        7\n#define LED6        8\n\n#define NUM_LEDS    7\n\n\n\/\/define RGB Byte for Randomizer\nbyte  r, g, b;\n\n\/\/linked array\nCRGB leds&#091;NUM_LEDS];\n\n\/\/define sound sensor\nconst int micPin = A0;\n\n\n\/\/state machine prep\nint mainState = 0;\n\nvoid setup() {\n  \/\/initialize serial monitor\n  Serial.begin(115200);\n\n  \/\/initialize frequency timer\n  samplingPeriod  = round(1000000 * (1.0 \/ SAMPLING_FREQUENCY)); \/\/period is microseconds\n  \/\/initialize LED strips\n\n  { \/\/strip 0\n    FastLED.addLeds&lt;WS2812, LED0, GRB&gt;(leds, NUM_LEDS);\n  }\n  { \/\/strip 1\n    FastLED.addLeds&lt;WS2812, LED1, GRB&gt;(leds, NUM_LEDS);\n  }\n  { \/\/strip 2\n    FastLED.addLeds&lt;WS2812, LED2, GRB&gt;(leds, NUM_LEDS);\n  }\n  { \/\/strip 3\n    FastLED.addLeds&lt;WS2812, LED3, GRB&gt;(leds, NUM_LEDS);\n  }\n  { \/\/strip 4\n    FastLED.addLeds&lt;WS2812, LED4, GRB&gt;(leds, NUM_LEDS);\n  }\n  { \/\/strip 5\n    FastLED.addLeds&lt;WS2812, LED5, GRB&gt;(leds, NUM_LEDS);\n  }\n  { \/\/strip 6\n    FastLED.addLeds&lt;WS2812, LED6, GRB&gt;(leds, NUM_LEDS);\n  }\n  \/\/Clear the LED strips\n  setAll(0, 0, 0);\n  delay(500);\n\n  Serial.println(\"Begin State Machine\");\n\n}\n\n\/\/initalize several programs for the code to run\n\n\/\/first light set\nvoid p1 () {\n\n  RGBLoop();\n\n}\n\n\/\/random appear\nvoid p2 () {\n\n  for (int cur = 0; cur &lt; NUM_LEDS; cur++) {\n    \/\/ chose random value for the r\/g\/b\n    r = random(0, 255);\n    g = random(0, 255);\n    b = random(0, 255);\n\n    \/\/set the value to the led\n    leds&#091;cur] = CRGB (r, g, b);\n\n    \/\/ set the colors set into the phisical LED\n    FastLED.show();\n\n    \/\/ delay 50 millis\n    FastLED.delay(200);\n  }\n  for (int fin = 0; fin &lt; NUM_LEDS; fin++) {\n    \/\/ chose random value for the r\/g\/b\n\n    \/\/set the value to the led\n    leds&#091;fin] = CRGB (0, 0, 0);\n\n    \/\/ set the colors set into the phisical LED\n    FastLED.show();\n\n    \/\/ delay 50 millis\n    FastLED.delay(200);\n  }\n}\n\n\/\/meteor rain\nvoid p3 () {\n\n  meteorRain(random(0, 255), random(0, 255), random(0, 255), 1, 200, false, 60);\n\n}\n\n\/\/cyclon\nvoid p4 () {\n\n  CylonBounce(random(0, 255), random(0, 255), random(0, 255), 1, 100, 100, 2);\n\n}\n\n\/\/burst\nvoid p5 () {\n\n  \/\/  TwinkleRandom(7, 100, false);\n\n  burst(1);\n\n}\n\n\/\/main decision code\nvoid lights(double peak = FFT.MajorPeak(vReal, SAMPLES, SAMPLING_FREQUENCY)) {\n\n  int pReal = peak - 10;\n\n  if (pReal &lt; 400  &amp;&amp; pReal &gt; 300) {\n    Serial.print(\"begin p1...\");\n    p1();\n    Serial.println(\"Complete\");\n    Serial.println();\n    delay(250);\n  }\n\n  else if (pReal &gt; 400 &amp;&amp; pReal &lt; 500) {\n    Serial.print(\"begin p2...\");\n    p2();\n    Serial.println(\"Complete\");\n    Serial.println();\n    delay(250);\n  }\n\n  else  if (pReal &lt; 600 &amp;&amp; pReal &gt; 500) {\n    Serial.print(\"begin p3...\");\n    p3();\n    Serial.println(\"Complete\");\n    Serial.println();\n    delay(250);\n  }\n\n  else if (pReal &gt; 600 &amp;&amp; pReal &lt; 700) {\n    Serial.print(\"begin p4...\");\n    p4();\n    Serial.println(\"Complete\");\n    Serial.println();\n    delay(250);\n  }\n\n  else if (pReal &gt; 700) {\n    Serial.print(\"begin p5...\");\n    p5();\n    Serial.println(\"Complete\");\n    Serial.println();\n    delay(250);\n  }\n\n  else {\n\n    Serial.println(\"nothing fits, return to other code\");\n    Serial.println();\n    delay(250);\n    return;\n\n  }\n}\n\nvoid loop() {\n  \/\/ put your main code here, to run repeatedly:\n\n  switch (mainState) {\n\n    case 0:\n      frequency();\n      Serial.println(\" Frequency determined. Move to lights\");\n      Serial.println();\n      mainState = 1;\n      delay(10);\n      break;\n\n    case 1:\n      lights(peak);\n      Serial.println(\"return to frequency\");\n      Serial.println();\n      mainState = 0;\n      break;\n\n    default:\n\n      break;\n  }\n}\n\n\n\/\/Simplified pixel controller\n\n\n\/\/show the strips\nvoid showStrip() {\n\n#ifndef ADAFRUIT_NEOPIXEL_H\n  \/\/ FastLED\n  FastLED.show();\n#endif\n}\n\n\/\/set a pixel for all strips\n\nvoid setPixel(int Pixel, byte red, byte green, byte blue) {\n#ifndef ADAFRUIT_NEOPIXEL_H\n  \/\/ FastLED\n\n  \/\/all strips\n  leds&#091;Pixel].r = red;\n  leds&#091;Pixel].g = green;\n  leds&#091;Pixel].b = blue;\n\n#endif\n}\n\n\/\/set all pixels\nvoid setAll(byte red, byte green, byte blue) {\n  for (int i = 0; i &lt; NUM_LEDS; i++ ) {\n    setPixel(i, red, green, blue);\n  }\n  showStrip();\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Fade Code<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void RGBLoop(){\n  for(int j = 0; j &lt; 3; j++ ) {\n    \/\/ Fade IN\n    for(int k = 0; k &lt; 256; k++) {\n      switch(j) {\n        case 0: setAll(k,0,0); break;\n        case 1: setAll(0,k,0); break;\n        case 2: setAll(0,0,k); break;\n      }\n      \/\/showStrip();\n      \n    }\n    \/\/ Fade OUT\n    for(int k = 255; k &gt;= 0; k--) {\n      switch(j) {\n        case 0: setAll(k,0,0); break;\n        case 1: setAll(0,k,0); break;\n        case 2: setAll(0,0,k); break;\n      }\n      \/\/showStrip();\n      \n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Meteor Rain Code<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {\n  setAll(0, 0, 0);\n\n  for (int i = 0; i &lt; NUM_LEDS + NUM_LEDS; i++) {\n\n\n    \/\/ fade brightness all LEDs one step\n    for (int j = 0; j &lt; NUM_LEDS; j++) {\n      if ( (!meteorRandomDecay) || (random(10) &gt; 5) ) {\n        fadeToBlack(j, meteorTrailDecay );\n      }\n    }\n\n    \/\/ draw meteor\n    for (int j = 0; j &lt; meteorSize; j++) {\n      if ( ( i - j &lt; NUM_LEDS) &amp;&amp; (i - j &gt;= 0) ) {\n        setPixel(i - j, red, green, blue);\n      }\n    }\n\n    showStrip();\n    delay(SpeedDelay);\n  }\n}\n\nvoid fadeToBlack(int ledNo, byte fadeValue) {\n  \/\/ #ifdef ADAFRUIT_NEOPIXEL_H\n  \/\/    \/\/ NeoPixel\n  \/\/    uint32_t oldColor;\n  \/\/    uint8_t r, g, b;\n  \/\/    int value;\n  \/\/\n  \/\/    oldColor = strip.getPixelColor(ledNo);\n  \/\/    r = (oldColor &amp; 0x00ff0000UL) &gt;&gt; 16;\n  \/\/    g = (oldColor &amp; 0x0000ff00UL) &gt;&gt; 8;\n  \/\/    b = (oldColor &amp; 0x000000ffUL);\n  \/\/\n  \/\/    r=(r&lt;=10)? 0 : (int) r-(r*fadeValue\/256);\n  \/\/    g=(g&lt;=10)? 0 : (int) g-(g*fadeValue\/256);\n  \/\/    b=(b&lt;=10)? 0 : (int) b-(b*fadeValue\/256);\n  \/\/\n  \/\/    strip.setPixelColor(ledNo, r,g,b);\n  \/\/ #endif\n#ifndef ADAFRUIT_NEOPIXEL_H\n  \/\/ FastLED\n  \n  leds&#091;ledNo].fadeToBlackBy( fadeValue );\n  \n#endif\n}\n\n\n<\/code><\/pre>\n\n\n\n<p><strong>Cyclon Code<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void CylonBounce(byte red, byte green, byte blue, int EyeSize, int SpeedDelay, int ReturnDelay, int counter) {\n\n  for (int i = 0; i &lt; counter; i++) {\n\n    for (int i = 0; i &lt; NUM_LEDS - EyeSize - 2; i++) {\n      setAll(0, 0, 0);\n      setPixel(i, red \/ 10, green \/ 10, blue \/ 10);\n      for (int j = 1; j &lt;= EyeSize; j++) {\n        setPixel(i + j, red, green, blue);\n      }\n      setPixel(i + EyeSize + 1, red \/ 10, green \/ 10, blue \/ 10);\n      showStrip();\n      delay(SpeedDelay);\n    }\n\n    delay(ReturnDelay);\n\n    for (int i = NUM_LEDS - EyeSize - 2; i &gt; (-1); i--) {\n      setAll(0, 0, 0);\n      setPixel(i, red \/ 10, green \/ 10, blue \/ 10);\n      for (int j = 1; j &lt;= EyeSize; j++) {\n        setPixel(i + j, red, green, blue);\n      }\n      setPixel(i + EyeSize + 1, red \/ 10, green \/ 10, blue \/ 10);\n      showStrip();\n      delay(SpeedDelay);\n    }\n\n    delay(ReturnDelay);\n\n    setAll(0, 0, 0);\n  }\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Burst Code<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void burst(int count) {\n\n  r = random(0, 255);\n  g = random(0, 255);\n  b = random(0, 255);\n\n\n  for (int i = 0; i &lt; count; i++) {\n\n    \/\/sparks\n    setPixel(NUM_LEDS * (0.3), random(0, 255), random(0, 255), random(0, 255));\n    showStrip();\n    delay(100);\n    setAll(0, 0, 0);\n    delay(100);\n    setPixel(NUM_LEDS * (0.8), random(0, 255), random(0, 255), random(0, 255));\n    showStrip();\n    delay(100);\n    showStrip();\n    setAll(0, 0, 0);\n    delay(100);\n    setPixel(NUM_LEDS * (0.1), random(0, 255), random(0, 255), random(0, 255));\n    showStrip();\n    delay(100);\n    setAll(0, 0, 0);\n    delay(100);\n\n    \/\/BURST OUT\n    setPixel(3, r, g, b);\n    showStrip();\n    delay(300);\n\n    \/\/fade out\n    for (int j = 0; j &lt; 3; j++ ) {\n\n      for (int k = 255; k &gt;= 0; k--) {\n        switch (j) {\n          case 0: setAll(k, 0, 0); break;\n          case 1: setAll(0, k, 0); break;\n          case 2: setAll(0, 0, k); break;\n        }\n      }\n    }\n    \n  }\n}\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Over the last 7 weeks, I have spent lots of time working on finalizing a design of a frequency reactive light panel, and here I have the final results of this project.adidas yeezy 700 v3 nike air max 1 ultra moire black white \u0e23\u0e32\u0e04\u0e32 shampoo isdin lambdapil Mexico ciorapi compresivi pana la coapsa scarpe eleganti&#8230; <\/p>\n<div class=\"link-more\"><a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/tcwiseman\/final-project-documentation-frequency-reactive-led-panel\/\">Read More<\/a><\/div>\n","protected":false},"author":266,"featured_media":747,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-742","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"jetpack_featured_media_url":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-content\/uploads\/sites\/23\/2022\/05\/IMG_3321-scaled.jpg","_links":{"self":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/posts\/742","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/users\/266"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/comments?post=742"}],"version-history":[{"count":3,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/posts\/742\/revisions"}],"predecessor-version":[{"id":935,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/posts\/742\/revisions\/935"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/media\/747"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/media?parent=742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/categories?post=742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-d22\/wp-json\/wp\/v2\/tags?post=742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}