1

Тема: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/07/c36415c0a03730fe582c97c000160e6c.png


#define GAIN 15
#define STEP 10

#include <LiquidCrystal.h>
  LiquidCrystal lcd(2, 3, 4, 5, 6, 7);// RS,E,D4,D5,D6,D7
  byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
  byte z,z0,z1;
  int ur,ul,urr,ull;
 
  

void setup() {
  lcd.begin(16, 2);// LCD 16X2
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);
 // analogReference(INTERNAL);
  pinMode(A0,INPUT);// A0 - аналоговый вход
  pinMode(A1,INPUT);// A1 - аналоговый вход
}

void loop() {
  urr = log(analogRead(0))*GAIN;
  ull = log(analogRead(1))*GAIN;
 
  lcd.setCursor(0,1);lcd.print("R");
  lcd.setCursor(0,0);lcd.print("L");
  
   if(urr<ur){ur=ur-1;delay(STEP);}else{ur = urr;}
  for(z=0,z0=0,z1=0;z<=ur;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+2,1);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}

   if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)2);}
   
  delay(1);
}

2

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/07/02305288ed49206680059eb432879376.png

http://forum.rcl-radio.ru/uploads/images/2020/07/7fd29af5274d03122562990201ec8e8a.png


#define GAIN 14 // усиление 0...50
#define STEP 2  // плавность полос 0...20
#define RL 1    // RL - горизонт, вертикаль 0...1

#include <LiquidCrystal.h>
#include <EEPROM.h>
  LiquidCrystal lcd(2, 3, 4, 5, 6, 7);// RS,E,D4,D5,D6,D7
  byte z,z0,z1,w,www=1;
  int ur,ul,urr,ull;
  

void setup() {
  pinMode(8,INPUT_PULLUP);
  byte znak_r[8]={0b00000,0b00000,0b11111,0b00101,0b00101,0b11010,0b00000,0b00000};
  byte znak_l[8]={0b00000,0b00000,0b11111,0b10000,0b10000,0b10000,0b00000,0b00000};
  lcd.createChar(4,znak_r); 
  lcd.createChar(5,znak_l);
  lcd.begin(16, 2);// LCD 16X2
 // analogReference(INTERNAL);  // если очень маленький уровень сигнала
  pinMode(A0,INPUT);// A0 - аналоговый вход R
  pinMode(A1,INPUT);// A1 - аналоговый вход L
  w=EEPROM.read(0);
}

void loop() {
  if(digitalRead(8)==LOW){w++;www=1;if(w>4){w=0;}delay(200);EEPROM.update(0,w);}

  if(w==0&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);}
  if(w==1&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);} 
  if(w==2&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b10000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);} 
  if(w==3&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);}
  if(w==4&&www==1){www=0;
  byte a1[8] = {0b00000,0b00000,0b10101,0b10101,0b10101,0b10101,0b00000,0b00000};
  byte a2[8] = {0b00000,0b00000,0b10100,0b10100,0b10100,0b10100,0b00000,0b00000};
  byte a3[8] = {0b00000,0b00000,0b10000,0b10000,0b10000,0b10000,0b00000,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);} 
  
  urr = log(analogRead(0))*GAIN;
  ull = log(analogRead(1))*GAIN;

  if(RL==0){lcd.setCursor(0,0);lcd.write((uint8_t)4);lcd.setCursor(0,1);lcd.write((uint8_t)5);}
  if(RL==1){lcd.setCursor(0,1);lcd.print("L");lcd.setCursor(0,0);lcd.print("R");}
  
   if(urr<ur){ur=ur-1;delay(STEP);}else{ur = urr;}
  for(z=0,z0=0,z1=0;z<=ur;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+2,1);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}

   if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)2);}
   
  delay(1);
}

3

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/07/627e9c1679cb5d86d1e5acefb7160554.png

http://forum.rcl-radio.ru/uploads/images/2020/07/c8e99932c4452b56fb67b031eabb11af.png


#define GAIN 1 // усиление 0...50
#define STEP 2  // плавность полос 0...20
#define RL 0    // RL - горизонт, вертикаль 0...1

#include <LiquidCrystal.h>
#include <EEPROM.h>
  LiquidCrystal lcd(2, 3, 4, 5, 6, 7);// RS,E,D4,D5,D6,D7
  byte z,z0,z1,w,www=1;
  int ur,ul,urr,ull,urrr,ulll;
  int x,i,u_maxr,u_maxl;
  int u_l0[20],u_r0[20];
  

void setup() {
  pinMode(8,INPUT_PULLUP);
  byte znak_r[8]={0b00000,0b00000,0b11111,0b00101,0b00101,0b11010,0b00000,0b00000};
  byte znak_l[8]={0b00000,0b00000,0b11111,0b10000,0b10000,0b10000,0b00000,0b00000};
  lcd.createChar(4,znak_r); 
  lcd.createChar(5,znak_l);
  lcd.begin(16, 2);// LCD 16X2
 // analogReference(INTERNAL);  // если очень маленький уровень сигнала
  pinMode(A0,INPUT);// A0 - аналоговый вход R
  pinMode(A1,INPUT);// A1 - аналоговый вход L
  w=EEPROM.read(0);
}

void loop() {
  if(digitalRead(8)==LOW){w++;www=1;if(w>4){w=0;}delay(200);EEPROM.update(0,w);}

  if(w==0&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000};
  byte a4[8] = {0b00100,0b00100,0b00100,0b00100,0b00100,0b00100,0b00100,0b00100};// 
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==1&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
  byte a4[8] = {0b00000,0b00100,0b00100,0b00100,0b00100,0b00100,0b00100,0b00000};//  
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==2&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b10000};
  byte a4[8] = {0b00100,0b00100,0b00100,0b00100,0b00100,0b00100,0b00100,0b00100}; 
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==3&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b00000};
  byte a4[8] = {0b00000,0b00100,0b00100,0b00100,0b00100,0b00100,0b00100,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==4&&www==1){www=0;
  byte a1[8] = {0b00000,0b00000,0b10101,0b10101,0b10101,0b10101,0b00000,0b00000};
  byte a2[8] = {0b00000,0b00000,0b10100,0b10100,0b10100,0b10100,0b00000,0b00000};
  byte a3[8] = {0b00000,0b00000,0b10000,0b10000,0b10000,0b10000,0b00000,0b00000};
  byte a4[8] = {0b00000,0b00000,0b00100,0b00100,0b00100,0b00100,0b00000,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  
  urr = (analogRead(0))*GAIN;if(urr>41){urr=41;}
  ull = (analogRead(1))*GAIN;if(ull>41){ull=41;}

  if(RL==0){lcd.setCursor(0,0);lcd.write((uint8_t)4);lcd.setCursor(0,1);lcd.write((uint8_t)5);}
  if(RL==1){lcd.setCursor(0,1);lcd.print("L");lcd.setCursor(0,0);lcd.print("R");}
  
   if(urr<ur){ur=ur-1;delay(STEP);}else{ur = urr;}
  for(z=0,z0=0,z1=0;z<=ur;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+2,1);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}

   if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)2);}

//////////////////////////////////////////////////////////

i++;if(i<19){u_l0[i]=ull;u_r0[i]=urr;}else{i=1;}
  if(i==18){u_maxr=-1;u_maxl=-1;
    for(x=1;x<=15;x++){
      u_maxl=max(u_maxl,u_l0[x]);
      u_maxr=max(u_maxr,u_r0[x]);}}

  if(u_maxl<=ull){u_maxl=ull+1;} 
  if(u_maxr<=urr){u_maxr=urr+1;}
  
  if(u_maxl<ulll){ulll=ulll-1;}else{ulll = u_maxl;}
  if(u_maxr<urrr){urrr=urrr-1;}else{urrr = u_maxr;}
  
 
  lcd.setCursor(ulll/3+1,0);if(ulll/3>2){lcd.write((uint8_t)6);}lcd.print("  ");
  lcd.setCursor(urrr/3+1,1);if(urrr/3>2){lcd.write((uint8_t)6);}lcd.print("  "); 
  delay(3);
}

4

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/07/ee01fa966e000c7004e524565345ca9d.png

#define GAIN 14 // усиление 0...50
#define STEP 2  // плавность полос 0...20
#define RL 1    // RL - горизонт, вертикаль 0...1
 
#include <LiquidCrystal.h>
#include <EEPROM.h>
  LiquidCrystal lcd(2, 3, 4, 5, 6, 7);// RS,E,D4,D5,D6,D7
  byte z,z0,z1,w,www=1;
  int ur,ul,urr,ull,urrr,ulll;
  int x,i,u_maxr,u_maxl;
  int u_l0[20],u_r0[20];
 
 
void setup() {
  pinMode(8,INPUT_PULLUP);
  byte znak_r[8]={0b00000,0b00000,0b11111,0b00101,0b00101,0b11010,0b00000,0b00000};
  byte znak_l[8]={0b00000,0b00000,0b11111,0b10000,0b10000,0b10000,0b00000,0b00000};
  lcd.createChar(4,znak_r); 
  lcd.createChar(5,znak_l);
  lcd.begin(16, 2);// LCD 16X2
 // analogReference(INTERNAL);  // если очень маленький уровень сигнала
  pinMode(A0,INPUT);// A0 - аналоговый вход R
  pinMode(A1,INPUT);// A1 - аналоговый вход L
  w=EEPROM.read(0);
}
 
void loop() {
  if(digitalRead(8)==LOW){w++;www=1;if(w>4){w=0;}delay(200);EEPROM.update(0,w);}
 
  if(w==0&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000};
  byte a4[8] = {0b00011,0b00011,0b00011,0b0011,0b0011,0b0011,0b0011,0b0011};// 
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==1&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
  byte a4[8] = {0b00000,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b00000};//  
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==2&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b10000};
  byte a4[8] = {0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011}; 
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==3&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b00000};
  byte a4[8] = {0b00000,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
  if(w==4&&www==1){www=0;
  byte a1[8] = {0b00000,0b00000,0b10101,0b10101,0b10101,0b10101,0b00000,0b00000};
  byte a2[8] = {0b00000,0b00000,0b10100,0b10100,0b10100,0b10100,0b00000,0b00000};
  byte a3[8] = {0b00000,0b00000,0b10000,0b10000,0b10000,0b10000,0b00000,0b00000};
  byte a4[8] = {0b00000,0b00000,0b0011,0b0011,0b0011,0b0011,0b00000,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);} 
 
  urr = log(analogRead(0))*GAIN;if(urr>41){urr=41;}
  ull = log(analogRead(1))*GAIN;if(ull>41){ull=41;}
 
  if(RL==0){lcd.setCursor(0,0);lcd.write((uint8_t)4);lcd.setCursor(0,1);lcd.write((uint8_t)5);}
  if(RL==1){lcd.setCursor(0,1);lcd.print("L");lcd.setCursor(0,0);lcd.print("R");}
 
   if(urr<ur){ur=ur-1;delay(STEP);}else{ur = urr;}
  for(z=0,z0=0,z1=0;z<=ur;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+2,1);if(ur<39){lcd.print(" ");}}}
   if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}
 
   if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);if(ul<39){lcd.print(" ");}}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)2);}
 
//////////////////////////////////////////////////////////
 
i++;if(i<19){u_l0[i]=abs(ull);u_r0[i]=abs(urr);}else{i=1;}
  if(i==18){u_maxr=0;u_maxl=0;
    for(x=1;x<=15;x++){
      u_maxl=max(u_maxl,u_l0[x]);
      u_maxr=max(u_maxr,u_r0[x]);}}
 
  if(u_maxl<=ull){u_maxl=ull+1;} 
  if(u_maxr<=urr){u_maxr=urr+1;}
 
  if(u_maxl<ulll){ulll=ulll-1;delay(STEP);}else{ulll = u_maxl;}
  if(u_maxr<urrr){urrr=urrr-1;delay(STEP);}else{urrr = u_maxr;}
 
 
  lcd.setCursor(ulll/3+1,0);if(ulll/3>2){lcd.write((uint8_t)6);}lcd.print("  ");
  lcd.setCursor(urrr/3+1,1);if(urrr/3>2){lcd.write((uint8_t)6);}lcd.print("  "); 
  delay(3);
}

5

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/07/6726611315b8db462f135a2462ab6c86.png

#define GAIN 14 // усиление 0...50
#define STEP 2  // плавность полос 0...20
#define RL 1    // RL - горизонт, вертикаль 0...1
 
#include <LiquidCrystal.h>
#include <EEPROM.h>
  LiquidCrystal lcd(2, 3, 4, 5, 6, 7);// RS,E,D4,D5,D6,D7
  byte z,z0,z1,w,www=1;
  int ur,ul,urr,ull,urrr,ulll;
  int x,i,u_maxr,u_maxl;
  int u_l0[20],u_r0[20];
 
 
void setup() {
  pinMode(8,INPUT_PULLUP);
  byte znak_r[8]={0b00000,0b00000,0b11111,0b00101,0b00101,0b11010,0b00000,0b00000};
  byte znak_l[8]={0b00000,0b00000,0b11111,0b10000,0b10000,0b10000,0b00000,0b00000};
  lcd.createChar(4,znak_r); 
  lcd.createChar(5,znak_l);
  lcd.begin(16, 2);// LCD 16X2
 // analogReference(INTERNAL);  // если очень маленький уровень сигнала
  pinMode(A0,INPUT);// A0 - аналоговый вход R
  pinMode(A1,INPUT);// A1 - аналоговый вход L
  w=EEPROM.read(0);
}
 
void loop() {
  if(digitalRead(8)==LOW){w++;www=1;if(w>4){w=0;}delay(200);EEPROM.update(0,w);}
 
  if(w==0&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000};
  byte a4[8] = {0b00011,0b00011,0b00011,0b0011,0b0011,0b0011,0b0011,0b0011};
  byte a5[8] = {0b11000,0b11000,0b11000,0b11000,0b11000,0b11000,0b11000,0b11000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);lcd.createChar(7,a5);} 
  if(w==1&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
  byte a4[8] = {0b00000,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b00000};//  
  byte a5[8] = {0b00000,0b11000,0b11000,0b11000,0b11000,0b11000,0b11000,0b00000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);lcd.createChar(7,a5);} 
  if(w==2&&www==1){www=0;
  byte a1[8] = {0b10101,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b10101};
  byte a2[8] = {0b10100,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b10100};
  byte a3[8] = {0b10000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b10000};
  byte a4[8] = {0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011}; 
  byte a5[8] = {0b11000,0b11000,0b11000,0b11000,0b11000,0b11000,0b11000,0b11000};
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);lcd.createChar(7,a5);} 
  if(w==3&&www==1){www=0;
  byte a1[8] = {0b00000,0b10101,0b10101,0b00000,0b00000,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b00000,0b00000,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b00000,0b00000,0b10000,0b10000,0b00000};
  byte a4[8] = {0b00000,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b00000};
  byte a5[8] = {0b00000,0b11000,0b11000,0b11000,0b11000,0b11000,0b11000,0b00000};  
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);lcd.createChar(7,a5);} 
  if(w==4&&www==1){www=0;
  byte a1[8] = {0b00000,0b00000,0b10101,0b10101,0b10101,0b10101,0b00000,0b00000};
  byte a2[8] = {0b00000,0b00000,0b10100,0b10100,0b10100,0b10100,0b00000,0b00000};
  byte a3[8] = {0b00000,0b00000,0b10000,0b10000,0b10000,0b10000,0b00000,0b00000};
  byte a4[8] = {0b00000,0b00000,0b0011,0b0011,0b0011,0b0011,0b00000,0b00000};
  byte a5[8] = {0b00000,0b00000,0b11000,0b11000,0b11000,0b11000,0b00000,0b00000};  
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);lcd.createChar(6,a4);lcd.createChar(7,a5);} 
 
  urr = log(analogRead(0))*GAIN;if(urr>41){urr=41;}
  ull = log(analogRead(1))*GAIN;if(ull>41){ull=41;}
 
  if(RL==0){lcd.setCursor(0,0);lcd.write((uint8_t)4);lcd.setCursor(0,1);lcd.write((uint8_t)5);}
  if(RL==1){lcd.setCursor(0,1);lcd.print("L");lcd.setCursor(0,0);lcd.print("R");}
 
   if(urr<ur){ur=ur-1;delay(STEP);}else{ur = urr;}
  for(z=0,z0=0,z1=0;z<=ur;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+2,1);if(ur<39){lcd.print(" ");}}}
   if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}
 
   if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);if(ul<39){lcd.print(" ");}}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)2);}
 
//////////////////////////////////////////////////////////
 
i++;if(i<19){u_l0[i]=abs(ull);u_r0[i]=abs(urr);}else{i=1;}
  if(i==18){u_maxr=0;u_maxl=0;
    for(x=1;x<=15;x++){
      u_maxl=max(u_maxl,u_l0[x]);
      u_maxr=max(u_maxr,u_r0[x]);}}
   
  if(u_maxl<ulll){ulll=ulll-1;}else{ulll = u_maxl;}
  if(u_maxr<urrr){urrr=urrr-1;}else{urrr = u_maxr;}
  
  if(u_maxl<=ul){u_maxl=ull+1;} 
  if(u_maxr<=ur){u_maxr=urr+1;}

  lcd.setCursor(ulll/3+1,0);if(ulll/3>2){if(ulll/10%2==1){lcd.write((uint8_t)7);}if(ulll/10%2==0){lcd.write((uint8_t)6);}}lcd.print("  ");
  lcd.setCursor(urrr/3+1,1);if(urrr/3>2){if(urrr/10%2==1){lcd.write((uint8_t)7);}if(urrr/10%2==0){lcd.write((uint8_t)6);}}lcd.print("  "); 
  delay(3);
}

6

Re: VU метр

Здравствуйте
Как сделать чтобы  "L канал" использовал byte a4,a5, a6

#define GAIN 5.5
#define STEP 10


#include <LiquidCrystal.h>
LiquidCrystal lcd(PA0, PA1, PA2, PA3, PA4, PA5);
/*
byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
  byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
  byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
*/


  byte a1[8] = {0b11111,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000};
  byte a2[8] = {0b11111,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000};
  byte a3[8] = {0b11111,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000};
  //////////////////
  
  byte a4[8] = {0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b1111};
  byte a5[8] = {0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b1111};
  byte a6[8] = {0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b00000,0b1111};
  ////////////////
  
 // byte z,z0,z1;
 // int ur,ul,urr,ull;
 ////////////
 byte z,z0,z1,z2,z3,z4;
  int ur,ul,urr,ull;
 ////////////
  


void setup() {
  lcd.begin(16, 2);// LCD 16X2
  lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);
  lcd.createChar(0,a4);lcd.createChar(1,a5);lcd.createChar(2,a6); 
 //analogReference(INTERNAL);
  pinMode(PA6,INPUT);// A0 - аналоговый вход
  pinMode(PB0,INPUT);// A1 - аналоговый вход
}


void loop() {
  urr = log(analogRead(PA6))*GAIN;
  ull = log(analogRead(PB0))*GAIN;
 
  lcd.setCursor(0,1);lcd.print("R");
  lcd.setCursor(0,0);lcd.print("L");
  //R канал
  //*************************************
   if(urr<ur){ur=ur-1;delay(STEP);}else{ur = urr;}
  for(z=0,z0=0,z1=0;z<=ur;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+2,1);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}


 
 //L канал
 //******************************************************
 /*
 ////////////
 if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)2);}
 //////////
 */
   if(ull<ul){ul=ul-1;delay(STEP);}else{ul = ull;}
  for(z2=0,z3=0,z4=0;z2<=ul;z2++,z4++){if(z4>2){z4=0;z3++;}
    //for(z=0,z0=0,z1=0;z<=ul;z++,z1++){if(z1>2){z1=0;z0++;}
   if(z4==1){lcd.setCursor(z3+1,0);lcd.write((uint8_t)0);lcd.setCursor(z0+2,0);lcd.print(" ");}}
   if(z4==3){lcd.setCursor(z3+1,0);lcd.write((uint8_t)1);}
   if(z4==2){lcd.setCursor(z3+1,0);lcd.write((uint8_t)2);}
   
  delay(1);
}

7

Re: VU метр

lcd.createChar(0,a4);lcd.createChar(1,a5);lcd.createChar(2,a6);
заменить на
lcd.createChar(3,a4);lcd.createChar(4,a5);lcd.createChar(5,a6);

соотведственно поправьте код:
   if(z1==1){lcd.setCursor(z0+1,0);lcd.write((uint8_t)3);lcd.setCursor(z0+2,0);lcd.print(" ");}}
   if(z1==3){lcd.setCursor(z0+1,0);lcd.write((uint8_t)4);}
   if(z1==2){lcd.setCursor(z0+1,0);lcd.write((uint8_t)5);}

8

Re: VU метр

Отлично , получилось так
http://forum.rcl-radio.ru/uploads/images/2020/11/b48d3decb0ceb6377f1cbb7bbabfb00d.jpg

Спасибо
сейчас есть так

  lcd.setCursor(0,1);lcd.print("R");
  lcd.setCursor(0,0);lcd.print("L");

надо  так = поместить обе две линии в одном "row"

lcd.setCursor(0,0);lcd.print("L R")

9

Re: VU метр

lcd.setCursor(0,0);

= две строки канал L и R

lcd.setCursor(0,1);

= для цифр

10

Re: VU метр

byte znak_r[8]={0b00000,0b00000,0b11111,0b00101,0b00101,0b11010,0b00000,0b00000};
  byte znak_l[8]={0b00000,0b00000,0b11111,0b10000,0b10000,0b10000,0b00000,0b00000};
  lcd.createChar(6,znak_r);
  lcd.createChar(7,znak_l);

  lcd.setCursor(0,0);lcd.write((uint8_t)6);lcd.setCursor(0,1);lcd.write((uint8_t)7);

http://rcl-radio.ru/wp-content/uploads/2020/07/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0-%D0%BE%D1%82-2020-07-30-230455.png

11

Re: VU метр

Вы хотите добавить цифры в линию со шкалой?

12 (2020-11-07 22:48:18 отредактировано korted)

Re: VU метр

на моём снимке , убрать L  строку которая находится внизу L перенести в низ R.
получится чтото такое  R ========
расстояние между линиями будет больше равно высоте буквы
---------------------
-------------------------

13

Re: VU метр

???

14 (2020-11-07 22:58:19 отредактировано korted)

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/11/3ebeb0780be59efd71a7c0e1d589f9cf.jpg
photoshop

15

Re: VU метр

В одной строке для 2-х каналов не получится сделать, по крайней мере я не знаю как это сделать.

16

Re: VU метр

А повернуть на 90 градусов ?
http://forum.rcl-radio.ru/uploads/images/2020/11/aeb3f0f4cdcf3cef6359e20b30147899.jpg

17

Re: VU метр

Так

http://forum.rcl-radio.ru/uploads/images/2020/11/c76310baf7bbf7f29cfccd7a8e8f81aa.png

18

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/11/3b8a460b393567e68ad12082894f4a63.jpg

19

Re: VU метр

Это не сложно, так  же создаете массивы для знаков:

byte v1[8] = {0, 0, 0, 0, 0, 0, 0, 31};
      byte v2[8] = {0, 0, 0, 0, 0, 0, 31, 31};
      byte v3[8] = {0, 0, 0, 0, 0, 31, 31, 31};
      byte v4[8] = {0, 0, 0, 0, 31, 31, 31, 31};
      byte v5[8] = {0, 0, 0, 31, 31, 31, 31, 31};
      byte v6[8] = {0, 0, 31, 31, 31, 31, 31, 31};
      byte v7[8] = {0, 31, 31, 31, 31, 31, 31, 31};
      byte v8[8] = {31, 31, 31, 31, 31, 31, 31, 31};
      lcd.createChar(0, v1);lcd.createChar(1, v2);lcd.createChar(2, v3);lcd.createChar(3, v4);lcd.createChar(4, v5);lcd.createChar(5, v6);lcd.createChar(6, v7);lcd.createChar(7, v8);

потом выводите в зависимости от уровня звука
posLevel = map(analogRead(A0), 0,1023,0,10);
if(posLevel>5){
lcd.setCursor(0, 0);lcd.write((uint8_t)posLevel-5);
lcd.setCursor(1, 0);lcd.write((uint8_t)8);
}
if(posLevel<=5){
lcd.setCursor(0, 0);lcd.print(" ");
lcd.setCursor(1, 0);lcd.write((uint8_t)posLevel);}


примерно так для одного канала

20

Re: VU метр

http://forum.rcl-radio.ru/uploads/images/2020/11/78c03d9862d2e29ffb5dd136c9c2cb44.jpg

21

Re: VU метр

почти , надо с самого низу
http://forum.rcl-radio.ru/uploads/images/2020/11/641c714a7d4ca069434719d27d44c347.jpg

22

Re: VU метр

posLevel = map(analogRead(A0), 0,1023,0,10);
if(posLevel>5){
lcd.setCursor(0, 0);lcd.write((uint8_t)posLevel-5);
lcd.setCursor(0, 1);lcd.write((uint8_t)8);
}
if(posLevel<=5){
lcd.setCursor(0, 0);lcd.print(" ");
lcd.setCursor(0, 1);lcd.write((uint8_t)posLevel);}

23

Re: VU метр

один кусок сбежал
http://forum.rcl-radio.ru/uploads/images/2020/11/20eb5111d0feb6ee42c0835fa38fa6f6.jpg

#define GAIN 5.5
#define STEP 10

#include <LiquidCrystal.h>
LiquidCrystal lcd(PA0, PA1, PA2, PA3, PA4, PA5);
byte v1[8] = {0, 0, 0, 0, 0, 0, 0, 31};
byte v2[8] = {0, 0, 0, 0, 0, 0, 31, 31};
byte v3[8] = {0, 0, 0, 0, 0, 31, 31, 31};
byte v4[8] = {0, 0, 0, 0, 31, 31, 31, 31};
byte v5[8] = {0, 0, 0, 31, 31, 31, 31, 31};
byte v6[8] = {0, 0, 31, 31, 31, 31, 31, 31};
byte v7[8] = {0, 31, 31, 31, 31, 31, 31, 31};
byte v8[8] = {31, 31, 31, 31, 31, 31, 31, 31};


void setup() {
  lcd.begin(16, 2);// LCD 16X2

  pinMode(PA6, INPUT); // A0 - аналоговый вход
  pinMode(PB0, INPUT); // A1 - аналоговый вход
}

void loop() {
  /////////////
  lcd.createChar(0, v1); lcd.createChar(1, v2); lcd.createChar(2, v3); lcd.createChar(3, v4);
  lcd.createChar(4, v5); lcd.createChar(5, v6); lcd.createChar(6, v7); lcd.createChar(7, v8);
  int posLevel = map(analogRead(PA6), 0, 1023, 0, 10);
  if (posLevel > 5) {
    //lcd.setCursor(0, 0); lcd.write((uint8_t)posLevel - 5);
   // lcd.setCursor(1, 0); lcd.write((uint8_t)8);
    //////////////
  lcd.setCursor(0, 0); lcd.write((uint8_t)posLevel - 5);
   lcd.setCursor(1, 0); lcd.write((uint8_t)8);
   
    ////////////////
  }
  if (posLevel <= 5) {
    lcd.setCursor(0, 0); lcd.print(" ");
    lcd.setCursor(0, 1); lcd.write((uint8_t)posLevel);
  }

  delay(1);
}

24

Re: VU метр

#include <LiquidCrystal.h>
LiquidCrystal lcd(PA0, PA1, PA2, PA3, PA4, PA5);
byte v1[8] = {0, 0, 0, 0, 0, 0, 0, 31};
byte v2[8] = {0, 0, 0, 0, 0, 0, 31, 31};
byte v3[8] = {0, 0, 0, 0, 0, 31, 31, 31};
byte v4[8] = {0, 0, 0, 0, 31, 31, 31, 31};
byte v5[8] = {0, 0, 0, 31, 31, 31, 31, 31};
byte v6[8] = {0, 0, 31, 31, 31, 31, 31, 31};
byte v7[8] = {0, 31, 31, 31, 31, 31, 31, 31};
byte v8[8] = {31, 31, 31, 31, 31, 31, 31, 31};


void setup() {
  lcd.begin(16, 2);// LCD 16X2

  pinMode(PA6, INPUT); // A0 - аналоговый вход
  pinMode(PB0, INPUT); // A1 - аналоговый вход
}

void loop() {
  /////////////
  lcd.createChar(0, v1); lcd.createChar(1, v2); lcd.createChar(2, v3); lcd.createChar(3, v4);
  lcd.createChar(4, v5); lcd.createChar(5, v6); lcd.createChar(6, v7); lcd.createChar(7, v8);
  int posLevel = map(analogRead(PA6), 0, 1023, 0, 15);
  if (posLevel > 7) {
  lcd.setCursor(0, 0); lcd.write((uint8_t)posLevel - 7);
   lcd.setCursor(0, 1); lcd.write((uint8_t)8);
   
    ////////////////
  }
  if (posLevel <= 7) {
    lcd.setCursor(0, 0); lcd.print(" ");
    lcd.setCursor(0, 1); lcd.write((uint8_t)posLevel);
  }

 // delay(1);
}

25

Re: VU метр

почти , нижний прямоугольник исчезает когда напряжение увеличивать
http://forum.rcl-radio.ru/uploads/images/2020/11/4a51f3310317fb37afd4182f1d955876.jpg