Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
arduino code for a simple VU meter using 10 LED channels and an electret microphone, provided by Electronics Projects Hub
// Electronics Projects Hub - https://electronicsprojectshub.com/
// Subscribe : https://www.youtube.com/c/TechMaker1
// --> https://electronicsprojectshub.com/category/arduino/arduino-projects/
int led[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int input, i;
void setup()
{
for (i = 0; i < 10; i++)
pinMode(led[i], OUTPUT);
//Serial.begin(9600);
}
void loop()
{
input = analogRead(0);
//Serial.println(s);
input = input /3; //By changing the denomintor the sensitivity can be changed
if (input < 12)
{
if (input == 0)
{
for (i = 0; i < 10; i++)
{
digitalWrite(led[i], LOW);
}
}
else
{
for (i = 0; i < input; i++)
{
digitalWrite(led[i], HIGH);
delay(4);
}
for (i = i; i < 10; i++)
{
digitalWrite(led[i], LOW);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment