Arduino Music Reactive Leds
by Random Creations in Circuits > Art
534 Views, 3 Favorites, 0 Comments
Arduino Music Reactive Leds
Hello Friends!
This is my first instuctabel and that is about on Diy arduino Music Reactive leds.
so let's get staaaarted!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Required Materials
1. Arduino Uno R3(or any other compatible).
2. Leds(1.2,3 Optional).
3. cable to connect arduino with pc.
4. Breadboard
5. 10k,4.7k resistors
6. Mic
and a pc or laptop.
Wiring & Connections
Circuit is not complicated it is very esy just do as in picture.
pin A0 input
Code
just copy from below.
/////////////////Hamza Rehman\\\\\\\\\\\\\\\\
/////////////////////////Art of Tech\\\\\\\\\\\\\\\\\\
int music = A0; int output,a; int potval=A1; int number_of_led[20] = { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,32,33,34,35,36,37,38,39,40,41}; // Assign the pins for the leds void setup() { for (a = 0; a < 20; a++) pinMode(number_of_led[a], OUTPUT); }
void loop() { potval=analogRead(A1); output = analogRead(music); potval=map (potval,0,1024,5,40); output = output/potval;
if (output == 0) { for(a = 0; a < 20; a++) { digitalWrite(number_of_led[a], LOW); } } else { for (a = 0; a < output; a++) { digitalWrite(number_of_led[a], HIGH); } for(a = a; a < 20; a++) { digitalWrite(number_of_led[a], LOW); } } }
Video Guide
This is my own video from Art of Tech.