Arduino VU Meter
Arduino VU Meter
Arduino VU Meter
Original version:
https://www.instructables.com/id/ARDUINO-VU-METER/
Original description:
VU meter by siemenwauters, theredstonelabz and michiel H don't
forget to like and subscribe to support my work. tnx
*/
#include <LiquidCrystal.h>
byte Bar[8] = {
B11111,
B00000,
B11111,
B11111,
B11111,
B11111,
B00000,
B11111
};
byte L[8] = {
B00111,
B01000,
B10100,
B10100,
B10100,
B10111,
B01000,
B00111
};
byte R[8] = {
B00111,
B01000,
B10110,
B10101,
B10110,
B10101,
B01000,
B00111
};
byte EndMark[8] = {
B10000,
B01000,
B00100,
B00100,
B00100,
B00100,
B01000,
B10000
};
byte EmptyBar[8] = {
B11111,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B11111
};
byte peakHoldChar[8] = {
B11111,
B00000,
B01110,
B01110,
B01110,
B01110,
B00000,
B11111
};
void setup()
{
lcd.begin(40, 2); //Setting up LCD. 16 chars and 2 rows
lcd.createChar(1, Bar);
lcd.createChar(2, L);
lcd.createChar(3, R);
lcd.createChar(4, EmptyBar);
lcd.createChar(5, EndMark);
lcd.createChar(6, peakHoldChar);
delay(500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Loading...");
delay(50);
}
delay(500);
lcd.clear();
decayTime = millis();
}
void loop()
{
actualMillis = millis();
indexL++;
indexR++;
volR = right / 3;
volR = rightAvg;
}
else if (volR > (rightAvg + 2))
{
volR = (rightAvg + 2);
rightAvg = volR;
}
else
{
rightAvg = volR;
}
volL = left / 3;
volL = leftAvg;
}
else if (volL > (leftAvg + 2))
{
volL = (leftAvg + 2);
leftAvg = volL;
}
else
{
leftAvg = volL;
}
if (volL > leftPeak)
{
leftPeak = volL;
}