0% found this document useful (0 votes)
28K views4 pages

Arduino LED Music Visualizer

Arduino LED Music Visualizer from gallactronics.blogspot.in const int rownum[8] = { A5,A4,A3,A2,3,4,5,6}; // here you are naming the rows const int colnum[7] = { 7,8,9,10,11,12,13}; //here you are naming the columns int audioIn = A0; int Vin = 0; float audioVin = 0; //now you are saying which LEDs to light at what amplitude int blank[8][8] = { {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}}; int minimum[8][8]

Uploaded by

pomoff
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28K views4 pages

Arduino LED Music Visualizer

Arduino LED Music Visualizer from gallactronics.blogspot.in const int rownum[8] = { A5,A4,A3,A2,3,4,5,6}; // here you are naming the rows const int colnum[7] = { 7,8,9,10,11,12,13}; //here you are naming the columns int audioIn = A0; int Vin = 0; float audioVin = 0; //now you are saying which LEDs to light at what amplitude int blank[8][8] = { {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}, {0,0,0,0,0,0,0}}; int minimum[8][8]

Uploaded by

pomoff
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Arduino LED Music Visualizer

from
gallactronics.blogspot.in
const int rownum[8] = {
A5,A4,A3,A2,3,4,5,6};
// here you are naming the rows
const int colnum[7] = {
7,8,9,10,11,12,13};
//here you are naming the columns
int audioIn = A0;
int Vin = 0;
float audioVin = 0;
//now you are saying which LEDs to light at what amplitude
int blank[8][8] = {
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0}};
int minimum[8][8] = {
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,1,1,1,0,0},
{0,0,1,1,1,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0}};
int drum[8][8] = {
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},

{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0}};
int mediocre[8][8] = {
{0,0,0,0,0,0,0},
{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},
{0,1,1,1,1,1,0},
{0,0,0,0,0,0,0}};
int blast[8][8] = {
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,1}};
void setup() {
Serial.begin(19200);
// initialize the I/O pins as outputs:
// iterate over the pins:
for (int thisPin = 0; thisPin < 8; thisPin++) {
// initialize the output pins:
pinMode(colnum[thisPin], OUTPUT);
pinMode(rownum[thisPin], OUTPUT);
// take the col pins (i.e. the cathodes) high to ensure that
// the LEDS are off:
digitalWrite(colnum[thisPin], HIGH);
digitalWrite(rownum[thisPin], LOW);
}
}
void loop() {
// This could be rewritten to not use a delay, which would make it appear brighter
int audioVin = analogRead(A0);

Serial.println(audioVin, DEC);
//now you are specifying the ranges for the mp3 jack audio input voltage (audioVin)
if (audioVin < 6) {
drawScreen(blank);
} else if(audioVin < 14) {
drawScreen(minimum);
} else if (audioVin < 35) {
drawScreen(drum);
} else if (audioVin < 45) {
drawScreen(mediocre);
}else if (audioVin < 60) {
drawScreen(blast);
}
}
int row(int i) {
if(i == 1) {
return A5;
} else if (i == 2) {
return A4;
} else if (i == 3) {
return A3;
} else if (i == 4) {
return A2;
} else if (i == 5) {
return 3;
} else if (i == 6) {
return 4;
} else if (i == 7) {
return 5;
} else if (i == 8) {
return 6;
}
}
int col(int i) {
if(i == 1) {
return 7;
} else if (i == 2) {
return 8;
} else if (i == 3) {
return 9;
} else if (i == 4) {
return 10;
} else if (i == 5) {

return 11;
} else if (i == 6) {
return 12;
} else if (i == 7) {
return 13;
}
}
void drawScreen(int character[8][8]) {
for(int j = 0; j < 8; j++) {
// Turn the row on
int rowNumber = j + 1;
digitalWrite(row(rowNumber), LOW);
for (int k = 0; k < 8; k++) {
// draw some letter bits
int columnNumber = k + 1;
if(character[j][k] == 1) {
digitalWrite(col(columnNumber), HIGH);
}
digitalWrite(col(columnNumber), LOW);
}
digitalWrite(row(rowNumber), HIGH);
}
}

You might also like