<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; pga2311u + oled 0.96]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=681&amp;type=atom" />
	<updated>2024-12-03T13:18:04Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=681</id>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11073#p11073" />
			<content type="html"><![CDATA[<p>Регулировка громкости и так логарифмическая</p><p>вот строка ограничения регулировки громкости</p><p>void vol_func(){if(vol&lt;0){vol=0;}if(vol&gt;117){vol=117;}}</p><p>Если ограничить до&nbsp; 0 дБ то измените </p><p>void vol_func(){if(vol&lt;0){vol=0;}if(vol&gt;95){vol=95;}}</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-12-03T13:18:04Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11073#p11073</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11069#p11069" />
			<content type="html"><![CDATA[<p>Код очень хороший. Но регулировка громкости должна быть максимум 0 дБ. Может ли режим регулировки быть логарифмическим?</p>]]></content>
			<author>
				<name><![CDATA[gabiivg]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2325</uri>
			</author>
			<updated>2024-12-02T18:35:36Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11069#p11069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11066#p11066" />
			<content type="html"><![CDATA[<p>Регулировка громкости в pga2311u в дБ , шаг 0,5 дБ, но в скетче установлен шаг в 1 дБ.</p><br /><div class="quotebox"><blockquote><p>This results in a gain range of +31.5 dB (with N = 255) to −95.5 dB (with N = 1).</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-12-02T14:07:32Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11066#p11066</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11065#p11065" />
			<content type="html"><![CDATA[<p>Привет. Можно ли изменить так, чтобы громкость регулировалась в пределах от -95,5 дБ до 0 дБ, но увеличение громкости было логарифмическим, а не линейным?</p>]]></content>
			<author>
				<name><![CDATA[gabiivg]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2325</uri>
			</author>
			<updated>2024-12-02T14:01:31Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11065#p11065</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11043#p11043" />
			<content type="html"><![CDATA[<p>Спасибо! Пока без звука проверил, работает только дописал:<br /> pinMode(OUT_IN_1,OUTPUT);<br />&nbsp; pinMode(OUT_IN_2,OUTPUT);<br />&nbsp; pinMode(OUT_IN_3,OUTPUT);</p>]]></content>
			<author>
				<name><![CDATA[sushniakk]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2108</uri>
			</author>
			<updated>2024-11-25T17:25:52Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11043#p11043</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10978#p10978" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/11/1e95a3c6c99265e274f59bf642d2f0a4.png" alt="http://forum.rcl-radio.ru/uploads/images/2024/11/1e95a3c6c99265e274f59bf642d2f0a4.png" /></span> </p><br /><div class="codebox"><pre><code>#define CLK_ENC      9
#define DT_ENC      10
#define SW_ENC       8

#define CS_PGA       2
#define SCLK_PGA     3
#define DATA_PGA     4

#define BUTTON_INPUT A0
#define BUTTON_POWER A1
#define BUTTON_MUTE A2

#define OUT_IN_1      5
#define OUT_IN_2      6
#define OUT_IN_3      7

#define OUT_POWER    13
#define OUT_MUTE     12

#include &lt;Wire.h&gt; 
#include &lt;EEPROM.h&gt;
#include &lt;U8glib.h&gt;   // https://github.com/olikraus/u8glib/
#include &lt;Encoder.h&gt;  // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
#include &lt;MsTimer2.h&gt; // http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip
#include &lt;CS3310.h&gt;   // http://rcl-radio.ru/wp-content/uploads/2020/11/CS3310.zip

Encoder myEnc(CLK_ENC, DT_ENC);
CS3310 pga(CS_PGA,SCLK_PGA,DATA_PGA);
// U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);// OLED_1.3
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);// OLED_0.96

long times,oldPosition  = -999,newPosition;
int vol,menu,in,ball,vol_old;
bool mute=0,w=1,w1,power=0;

void setup(){
  Wire.begin();Serial.begin(9600);
  MsTimer2::set(1, to_Timer);MsTimer2::start();
  if(EEPROM.read(100)!=0){for(int i=0;i&lt;101;i++){EEPROM.update(i,0);}}
  pinMode(BUTTON_INPUT,INPUT_PULLUP); // КНОПКА INPUT
  pinMode(BUTTON_POWER,INPUT_PULLUP); // КНОПКА POWER 
  pinMode(BUTTON_MUTE,INPUT_PULLUP); // КНОПКА MUTE 
  pinMode(OUT_POWER,OUTPUT); digitalWrite(OUT_POWER,LOW);
  pinMode(OUT_MUTE,OUTPUT);
  pinMode(OUT_IN_1,OUTPUT);
  pinMode(OUT_IN_2,OUTPUT);
  pinMode(OUT_IN_3,OUTPUT);
  u8g.firstPage();  
   do {
  u8g.setFont(u8g_font_profont12r); 
  u8g.drawStr(20,10,&quot;AUDIO PROCESSOR&quot;);
  u8g.drawStr(42,35,&quot;PGA2311&quot;);
  u8g.drawStr(30,55,&quot;rcl-radio.ru&quot;);
  } while( u8g.nextPage() );
  delay(2000);
  vol = EEPROM.read(0);
  ball = EEPROM.read(1)-10;
  in = EEPROM.read(2);
  switch(in){
    case 0: digitalWrite(OUT_IN_1,HIGH);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,LOW);break;
    case 1: digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,HIGH);digitalWrite(OUT_IN_3,LOW);break;
    case 2: digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,HIGH);break;
    }
  audio();
  digitalWrite(OUT_POWER,HIGH);
  digitalWrite(OUT_MUTE,HIGH);
  }

void loop(){
/// MENU /////////////////////////////////////// 
if(power==0){
 if(digitalRead(SW_ENC)==LOW){menu++;if(menu&gt;1){menu=0;}times=millis();w=1;w1=1;delay(200);}
 if(digitalRead(BUTTON_INPUT)==LOW){in++;if(in&gt;2){in=0;}times=millis();w=1;w1=1;delay(200);}
 
 if(digitalRead(BUTTON_MUTE)==LOW&amp;&amp;mute==0){mute=1;menu=100;digitalWrite(OUT_MUTE,LOW);delay(300);
     u8g.firstPage();do {u8g.setFont(u8g_font_profont12r);u8g.drawStr(50,30,&quot;MUTE&quot;);} while( u8g.nextPage() );}
 if(digitalRead(BUTTON_MUTE)==LOW&amp;&amp;mute==1){mute=0;w=1;menu=0;delay(300);digitalWrite(OUT_MUTE,HIGH);}
}
 if(digitalRead(BUTTON_POWER)==LOW&amp;&amp;power==0){power=1;menu=100;digitalWrite(OUT_MUTE,LOW);delay(300);
     u8g.firstPage();do {u8g.setFont(u8g_font_profont12r);u8g.drawStr(37,30,&quot;POWER OFF&quot;);} while( u8g.nextPage() );digitalWrite(OUT_POWER,LOW);delay(3000);
     u8g.firstPage();do {} while( u8g.nextPage() );}
 if(digitalRead(BUTTON_POWER)==LOW&amp;&amp;power==1){power=0;w=1;menu=0;
 u8g.firstPage();do {u8g.setFont(u8g_font_profont12r);u8g.drawStr(37,30,&quot;POWER ON&quot;);} while( u8g.nextPage() );delay(2000);digitalWrite(OUT_POWER,HIGH);digitalWrite(OUT_MUTE,HIGH);}
 
 
/////////////// VOLUME /////////////////////////////////////////////////////////
 if(menu==0&amp;&amp;mute==0&amp;&amp;power==0){
  if(newPosition != oldPosition&amp;&amp;mute==0){oldPosition = newPosition;
  if(newPosition&gt;1){newPosition=1;}if(newPosition&lt;-1){newPosition=-1;}
  vol=vol+newPosition;myEnc.write(0);newPosition=0;times=millis();w=1;w1=1;vol_func();audio();} 
 } 
 if(menu==1&amp;&amp;mute==0&amp;&amp;power==0){
 if(newPosition != oldPosition){oldPosition = newPosition;
 if(newPosition&gt;1){newPosition=1;}if(newPosition&lt;-1){newPosition=-1;}
  ball=ball+newPosition;myEnc.write(0);newPosition=0;times=millis();w=1;w1=1;ball_func();audio();}
 }

 
 if(w==1&amp;&amp;power==0){w=0;
  u8g.firstPage();  
   do {
  u8g.setFont(u8g_font_profont12r);if(menu==0){u8g.drawStr(0,10,&quot;VOLUME&quot;);}else{u8g.drawStr(0,10,&quot;volume&quot;);}
  for(int v_pos=0; v_pos&lt;vol/1.5+1;v_pos+=4){u8g.drawBox(v_pos+45,2, 2, 8);}  
  u8g.setFont(u8g_font_profont15r);u8g.setPrintPos(35, 25);u8g.print(vol-100);u8g.drawStr(70,25,&quot;dB&quot;);
  u8g.drawLine(0, 32, 128, 32);
  u8g.setFont(u8g_font_profont12r);if(menu==1){u8g.drawStr(0,45,&quot;BALANCE&quot;);}else{u8g.drawStr(0,45,&quot;balance&quot;);}
   for(int b0_pos=0; b0_pos&lt;58+1;b0_pos+=4){u8g.drawBox(b0_pos+57,40, 2, 2);} 
   if(ball&gt;=0){ for(int b1_pos=0; b1_pos&lt;ball*3+1;b1_pos+=4){u8g.drawBox(b1_pos+85,37, 2, 8);}  }
   if(ball&lt;=0){ for(int b2_pos=0; b2_pos&gt;ball*3+1;b2_pos-=4){u8g.drawBox(b2_pos+85,37, 2, 8);}  }
  u8g.drawLine(0, 50, 128, 50);
 // u8g.setFont(u8g_font_profont12r);u8g.drawStr(0,64,&quot;INPUT&quot;);
  switch(in){
    case 0: u8g.drawStr(20,64,&quot;&gt;&gt;&gt;&gt; AUX_1 &lt;&lt;&lt;&lt;&quot;);digitalWrite(OUT_IN_1,HIGH);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,LOW);break;
    case 1: u8g.drawStr(20,64,&quot;&gt;&gt;&gt;&gt; AUX_2 &lt;&lt;&lt;&lt;&quot;);digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,HIGH);digitalWrite(OUT_IN_3,LOW);break;
    case 2: u8g.drawStr(20,64,&quot;&gt;&gt;&gt;&gt; AUX_3 &lt;&lt;&lt;&lt;&quot;);digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,HIGH);break;
    }
   } while( u8g.nextPage() );}  
 

//////// EEPROM //////////////////////////////////////////////////
  if(millis()-times&gt;10000 &amp;&amp; w1==1 &amp;&amp; mute==0 &amp;&amp; power==0){EEPROM.update(0,vol);EEPROM.update(1,ball+10);EEPROM.update(2,in);menu=0;w1=0;w=1;}
   
  } 

void audio(){
  pga.setVol(vol*2+ball*2,vol*2-ball*2);// byte 1...255 === -95.5...+31.5 dB (step 0.5 dB)
//  Serial.println(vol*2+ball*2);
//  Serial.println(vol*2-ball*2);
  }   

void to_Timer(){newPosition = myEnc.read()/4;}
void vol_func(){if(vol&lt;0){vol=0;}if(vol&gt;117){vol=117;}}
void ball_func(){if(ball&lt;-10){ball=-10;}if(ball&gt;10){ball=10;}}  </code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-11-09T09:19:40Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10978#p10978</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10977#p10977" />
			<content type="html"><![CDATA[<p>Номера выводов ардуино указаны в скетче, например</p><p>#define OUT_IN_1&nbsp; &nbsp; &nbsp; 5<br />#define OUT_IN_2&nbsp; &nbsp; &nbsp; 6<br />#define OUT_IN_3&nbsp; &nbsp; &nbsp; 7<br />Вы можете менять номера пинов ардуино на свое усмотрение, нельзя указывать А4 А5 D0 D1, они заняты под шину I2C и Serial port</p><p>Дисплей 1,3 или 0,96 OLED, закомментировать ненужный</p><p>// U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);// OLED_1.3<br />// U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);// OLED_0.96 </p><p>На выходе OUT_POWER 1 если усилитель работает и 0 если надо отключить</p><p>Все настройки сохраняются после 10 сек неактивности органов управления</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-11-09T08:02:43Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10977#p10977</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10976#p10976" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/11/0c2e45a44e735cb6c0b409efd1d4854d.png" alt="http://forum.rcl-radio.ru/uploads/images/2024/11/0c2e45a44e735cb6c0b409efd1d4854d.png" /></span> </p><p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/11/bdbf96347167bf2bb23254825fc9721f.png" alt="http://forum.rcl-radio.ru/uploads/images/2024/11/bdbf96347167bf2bb23254825fc9721f.png" /></span> </p><p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/11/7ef44a522d64fa7e1d00232cb4e1b1bc.png" alt="http://forum.rcl-radio.ru/uploads/images/2024/11/7ef44a522d64fa7e1d00232cb4e1b1bc.png" /></span> </p><div class="codebox"><pre><code>#define CLK_ENC      9
#define DT_ENC      10
#define SW_ENC       8

#define CS_PGA       2
#define SCLK_PGA     3
#define DATA_PGA     4

#define BUTTON_INPUT A0
#define BUTTON_POWER A1
#define BUTTON_MUTE A2

#define OUT_IN_1      5
#define OUT_IN_2      6
#define OUT_IN_3      7

#define OUT_POWER    13
#define OUT_MUTE     12

#include &lt;Wire.h&gt; 
#include &lt;EEPROM.h&gt;
#include &lt;U8glib.h&gt;   // https://github.com/olikraus/u8glib/
#include &lt;Encoder.h&gt;  // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
#include &lt;MsTimer2.h&gt; // http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip
#include &lt;CS3310.h&gt;   // http://rcl-radio.ru/wp-content/uploads/2020/11/CS3310.zip

Encoder myEnc(CLK_ENC, DT_ENC);
CS3310 pga(CS_PGA,SCLK_PGA,DATA_PGA);
// U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);// OLED_1.3
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);// OLED_0.96

long times,oldPosition  = -999,newPosition;
int vol,menu,in,ball,vol_old;
bool mute=0,w=1,w1,power=0;

void setup(){
  Wire.begin();Serial.begin(9600);
  MsTimer2::set(1, to_Timer);MsTimer2::start();
  if(EEPROM.read(100)!=0){for(int i=0;i&lt;101;i++){EEPROM.update(i,0);}}
  pinMode(BUTTON_INPUT,INPUT_PULLUP); // КНОПКА INPUT
  pinMode(BUTTON_POWER,INPUT_PULLUP); // КНОПКА POWER 
  pinMode(BUTTON_MUTE,INPUT_PULLUP); // КНОПКА MUTE 
  pinMode(OUT_POWER,OUTPUT); digitalWrite(OUT_POWER,LOW);
  pinMode(OUT_MUTE,OUTPUT);
  u8g.firstPage();  
   do {
  u8g.setFont(u8g_font_profont12r); 
  u8g.drawStr(20,10,&quot;AUDIO PROCESSOR&quot;);
  u8g.drawStr(42,35,&quot;PGA2311&quot;);
  u8g.drawStr(30,55,&quot;rcl-radio.ru&quot;);
  } while( u8g.nextPage() );
  delay(2000);
  vol = EEPROM.read(0);
  ball = EEPROM.read(1)-10;
  in = EEPROM.read(2);
  switch(in){
    case 0: digitalWrite(OUT_IN_1,HIGH);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,LOW);break;
    case 1: digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,HIGH);digitalWrite(OUT_IN_3,LOW);break;
    case 2: digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,HIGH);break;
    }
  audio();
  digitalWrite(OUT_POWER,HIGH);
  digitalWrite(OUT_MUTE,HIGH);
  }

void loop(){
/// MENU /////////////////////////////////////// 
if(power==0){
 if(digitalRead(SW_ENC)==LOW){menu++;if(menu&gt;1){menu=0;}times=millis();w=1;w1=1;delay(200);}
 if(digitalRead(BUTTON_INPUT)==LOW){in++;if(in&gt;2){in=0;}times=millis();w=1;w1=1;delay(200);}
 
 if(digitalRead(BUTTON_MUTE)==LOW&amp;&amp;mute==0){mute=1;menu=100;digitalWrite(OUT_MUTE,LOW);delay(300);
     u8g.firstPage();do {u8g.setFont(u8g_font_profont12r);u8g.drawStr(50,30,&quot;MUTE&quot;);} while( u8g.nextPage() );}
 if(digitalRead(BUTTON_MUTE)==LOW&amp;&amp;mute==1){mute=0;w=1;menu=0;delay(300);digitalWrite(OUT_MUTE,HIGH);}
}
 if(digitalRead(BUTTON_POWER)==LOW&amp;&amp;power==0){power=1;menu=100;digitalWrite(OUT_MUTE,LOW);delay(300);
     u8g.firstPage();do {u8g.setFont(u8g_font_profont12r);u8g.drawStr(37,30,&quot;POWER OFF&quot;);} while( u8g.nextPage() );digitalWrite(OUT_POWER,LOW);delay(3000);
     u8g.firstPage();do {} while( u8g.nextPage() );}
 if(digitalRead(BUTTON_POWER)==LOW&amp;&amp;power==1){power=0;w=1;menu=0;
 u8g.firstPage();do {u8g.setFont(u8g_font_profont12r);u8g.drawStr(37,30,&quot;POWER ON&quot;);} while( u8g.nextPage() );delay(2000);digitalWrite(OUT_POWER,HIGH);digitalWrite(OUT_MUTE,HIGH);}
 
 
/////////////// VOLUME /////////////////////////////////////////////////////////
 if(menu==0&amp;&amp;mute==0&amp;&amp;power==0){
  if(newPosition != oldPosition&amp;&amp;mute==0){oldPosition = newPosition;
  if(newPosition&gt;1){newPosition=1;}if(newPosition&lt;-1){newPosition=-1;}
  vol=vol+newPosition;myEnc.write(0);newPosition=0;times=millis();w=1;w1=1;vol_func();audio();} 
 } 
 if(menu==1&amp;&amp;mute==0&amp;&amp;power==0){
 if(newPosition != oldPosition){oldPosition = newPosition;
 if(newPosition&gt;1){newPosition=1;}if(newPosition&lt;-1){newPosition=-1;}
  ball=ball+newPosition;myEnc.write(0);newPosition=0;times=millis();w=1;w1=1;ball_func();audio();}
 }

 
 if(w==1&amp;&amp;power==0){w=0;
  u8g.firstPage();  
   do {
  u8g.setFont(u8g_font_profont12r);if(menu==0){u8g.drawStr(0,10,&quot;VOLUME&quot;);}else{u8g.drawStr(0,10,&quot;volume&quot;);}
  for(int v_pos=0; v_pos&lt;vol/1.5+1;v_pos+=4){u8g.drawBox(v_pos+45,2, 2, 8);}  
  u8g.setFont(u8g_font_profont15r);u8g.setPrintPos(35, 25);u8g.print(vol-100);u8g.drawStr(70,25,&quot;dB&quot;);
  u8g.drawLine(0, 32, 128, 32);
  u8g.setFont(u8g_font_profont12r);if(menu==1){u8g.drawStr(0,45,&quot;BALANCE&quot;);}else{u8g.drawStr(0,45,&quot;balance&quot;);}
   for(int b0_pos=0; b0_pos&lt;58+1;b0_pos+=4){u8g.drawBox(b0_pos+57,40, 2, 2);} 
   if(ball&gt;=0){ for(int b1_pos=0; b1_pos&lt;ball*3+1;b1_pos+=4){u8g.drawBox(b1_pos+85,37, 2, 8);}  }
   if(ball&lt;=0){ for(int b2_pos=0; b2_pos&gt;ball*3+1;b2_pos-=4){u8g.drawBox(b2_pos+85,37, 2, 8);}  }
  u8g.drawLine(0, 50, 128, 50);
  u8g.setFont(u8g_font_profont12r);u8g.drawStr(0,64,&quot;INPUT&quot;);
  switch(in){
    case 0: u8g.drawStr(50,64,&quot;AUX_1&quot;);digitalWrite(OUT_IN_1,HIGH);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,LOW);break;
    case 1: u8g.drawStr(50,64,&quot;AUX_2&quot;);digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,HIGH);digitalWrite(OUT_IN_3,LOW);break;
    case 2: u8g.drawStr(50,64,&quot;AUX_3&quot;);digitalWrite(OUT_IN_1,LOW);digitalWrite(OUT_IN_2,LOW);digitalWrite(OUT_IN_3,HIGH);break;
    }
   } while( u8g.nextPage() );}  
 

//////// EEPROM //////////////////////////////////////////////////
  if(millis()-times&gt;10000 &amp;&amp; w1==1 &amp;&amp; mute==0 &amp;&amp; power==0){EEPROM.update(0,vol);EEPROM.update(1,ball+10);EEPROM.update(2,in);menu=0;w1=0;w=1;}
   
  } 

void audio(){
  pga.setVol(vol*2+ball*2,vol*2-ball*2);// byte 1...255 === -95.5...+31.5 dB (step 0.5 dB)
  }   

void to_Timer(){newPosition = myEnc.read()/4;}
void vol_func(){if(vol&lt;0){vol=0;}if(vol&gt;117){vol=117;}}
void ball_func(){if(ball&lt;-10){ball=-10;}if(ball&gt;10){ball=10;}}  </code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-11-09T07:59:25Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10976#p10976</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10973#p10973" />
			<content type="html"><![CDATA[<p>Ооо, Великолепно! Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[sushniakk]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2108</uri>
			</author>
			<updated>2024-11-07T17:39:34Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10973#p10973</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10972#p10972" />
			<content type="html"><![CDATA[<p>На выходных постараюсь начать работу</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-11-07T14:32:54Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10972#p10972</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10971#p10971" />
			<content type="html"><![CDATA[<p>Спасибо, буду ждать.</p>]]></content>
			<author>
				<name><![CDATA[sushniakk]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2108</uri>
			</author>
			<updated>2024-11-06T05:50:24Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10971#p10971</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10969#p10969" />
			<content type="html"><![CDATA[<p>Я подумаю над этим вопросом.</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-11-05T17:41:30Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10969#p10969</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[pga2311u + oled 0.96]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10966#p10966" />
			<content type="html"><![CDATA[<p>Здравствуйте! Для начала хотел бы поблагодарить за такой замечательный ресурс, с вашей помощью собрал несколько отличных проектов(на tda 7439, и bd37534).<br /> Теперь хочу собрать на pga2311, единственное что можно в&nbsp; ваш скетч внести измениия: использовать oled, добавить селектор входов(три пары реле) и управление выходными реле(задержка включения АС)</p>]]></content>
			<author>
				<name><![CDATA[sushniakk]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2108</uri>
			</author>
			<updated>2024-11-05T06:33:09Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10966#p10966</id>
		</entry>
</feed>
