VU Meter Peak Hold Uno Nano
VU Meter Peak Hold Uno Nano
VU Meter Peak Hold Uno Nano
h>
#define T_REFRESH 25
#define T_PEAKHOLD (50 * T_REFRESH)
LiquidCrystal lcd(7, // RS
8, // E
3, // DB4
4, // DB5
5, // DB6
6 // DB7
);
int lmax[2];
int dly[2];
long lastT = 0;
lcd.setCursor(0, row);
lcd.write(row ? 'R' : 'L');
if(lmax[row] < 0)
lmax[row] = 0;
else
dly[row]++;
}
}
void setup() {
byte fillbar[8] = {
B00000,
B01000,
B01100,
B01010,
B01001,
B01010,
B01100,
B01000
};
byte mark[8] = {
B00000,
B01010,
B10001,
B10101,
B10001,
B01010,
B00000,
B00000
};
lcd.begin(16, 2);
lcd.createChar(0, fillbar);
lcd.createChar(1, mark);
lcd.setCursor(2, 0);
lcd.print("WAHYU AUDIO");
lcd.setCursor(16, 0);
lcd.write(1);
delay(125);
}
lcd.clear();
void loop() {
lastT += T_REFRESH;
int anL = map(sqrt(analogRead(IN_LEFT)*16), 0, 128, 0, 100);
int anR = map(sqrt(analogRead(IN_RIGHT)*16), 0, 128, 0, 100);
bar(0, anL);
bar(1, anR);
}