# Arduino Music Reactive Leds

221

2

2

## Introduction: 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Required Materials

1. Arduino Uno R3(or any other compatible).

2. Leds(1.2,3 Optional).

3. cable to connect arduino with pc.

5. 10k,4.7k resistors

6. Mic

and a pc or laptop.

## Step 2: Wiring & Connections

Circuit is not complicated it is very esy just do as in picture.

pin A0 input

## Step 3: 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); } } }

## Step 4: Video Guide

This is my own video from Art of Tech.

## Recommendations

6 1.3K
43 5.5K
97 7.3K
TIG Welding Class

340 Enrolled