Developing an LED Christmas tree
We are now familiar with the concept of sound visualization. We have also learnt about controlling an LED matrix with music. Now, we will develop an LED Christmas tree, which will blink the LEDs as per the music beats.
To develop the basic circuit which responds to the beats, connect the circuit as shown in the following image:
We will connect the audio input/mic to the analog pin 3 of the Arduino. We have connected LEDs to pins 5 to 12.
Once you have connected the circuit as mentioned, upload the following code on the Arduino:
#include <fix_fft.h> int LEDPins[] = {5, 6, 7, 8, 9, 10, 11, 12}; int x = 0; char imaginary[128], inputSignal[128]; char outputAverage[14]; int i = 0, inputValue; #define AUDIOPIN 1 void setup() { for (int i = 0; i < 8; i++) { pinMode(LEDPins[i], OUTPUT); } Serial.begin(9600); } void loop() { for (i = 0; i < 128; i++) { inputValue = analogRead(AUDIOPIN); inputSignal[i] = inputValue; imaginary[i...