<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=48&amp;type=atom" />
	<updated>2025-11-22T05:54:12Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=48</id>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11986#p11986" />
			<content type="html"><![CDATA[<p>xin chào ,tôi là người mới . tôi đang bị lạc trong một rừng phác thảo,có ai đó giúp tôi&nbsp; 1 bản phác thảo cho arduino nano+pt2313+lcd 16x2+encoder+ nút nhấn không ạ? xin cám ơn</p>]]></content>
			<author>
				<name><![CDATA[unlockfreeall]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=3962</uri>
			</author>
			<updated>2025-11-22T05:54:12Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11986#p11986</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11936#p11936" />
			<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>2025-10-15T00:04:15Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11936#p11936</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11935#p11935" />
			<content type="html"><![CDATA[<p>Добрый вечер!<br />Господа, подскажите, кто профессионал. Ардуино работает, все показывает, но отклик на энкодер и пульт сильно уж долгий. Хотелось бы как на заводской аппаратуре - крутанул ручку и звук мгновенно громче или тише. Ардуино способен на такое? Ну там код через прерывания или что другое?<br />Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[introway]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=3342</uri>
			</author>
			<updated>2025-10-14T19:41:37Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11935#p11935</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11912#p11912" />
			<content type="html"><![CDATA[<p>Hi:<br />Could You mod this code to be well fit on&nbsp; 40x2 display, omit the rear and front options and one input and output, please?<br /><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2025/09/1bfcdc694e309fd16cb2dfea9bf537e3.jpg" alt="http://forum.rcl-radio.ru/uploads/images/2025/09/1bfcdc694e309fd16cb2dfea9bf537e3.jpg" /></span></p>]]></content>
			<author>
				<name><![CDATA[emersong]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=3863</uri>
			</author>
			<updated>2025-09-15T13:48:13Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11912#p11912</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11905#p11905" />
			<content type="html"><![CDATA[<p>Если тема еще жива, то прошу помощи, в самый первый выложенный скетч добавить кнопки Loud и Power (St-by) с выходом на управление реле а так же работу с пульта<br />Буду премного благодарен!<br />#define AUTO_GAIN 1&nbsp; &nbsp; &nbsp; &nbsp;// автонастройка по громкости<br />#define VOL_THR 35&nbsp; &nbsp; &nbsp; &nbsp; // порог тишины (ниже него отображения на матрице не будет)<br />#define LOW_PASS 30&nbsp; &nbsp; &nbsp; &nbsp;// нижний порог чувствительности шумов (нет скачков при отсутствии звука)<br />#define DEF_GAIN 80&nbsp; &nbsp; &nbsp; &nbsp;// максимальный порог по умолчанию <br />#define FHT_N 256&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// ширина спектра х2<br />#define LOG_OUT 1<br />#include &lt;FHT.h&gt; <br />#include &lt;Wire.h&gt;<br />#include &lt;PT2313.h&gt;<br />#include &lt;LiquidCrystal.h&gt;<br />#include &lt;Encoder.h&gt;<br />#include &lt;MsTimer2.h&gt;<br />#include &lt;boarddefs.h&gt;<br />#include &lt;IRremote.h&gt;<br />#include &lt;EEPROM.h&gt;<br />&nbsp; LiquidCrystal lcd(7, 6, 2, 3, 4, 5);// RS,E,D4,D5,D6,D7<br />&nbsp; PT2313 audioChip;<br />&nbsp; IRrecv irrecv(12); // указываем вывод модуля IR приемника<br />&nbsp; Encoder myEnc(9, 8);//CLK, DT<br />&nbsp; decode_results ir;<br /> byte posOffset[16] = {2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}; // вч выше<br /> byte menu,in,w,w2,gr1,gr2,www,z,z0,z1;<br /> int vol,vol_d,bass,bass_d,treb,treb_d,balans,gain,gain0,gain1,gain2;<br /> unsigned long time,oldPosition&nbsp; = -999,newPosition;<br /> unsigned long gainTimer;<br /> byte maxValue, maxValue_f,spek;<br /> float k = 0.1;<br /> byte gain_sp = DEF_GAIN;&nbsp; <br /> int i1,yyy;</p> <br /><p>void setup(){<br />&nbsp; Serial.begin(9600);Wire.begin(); lcd.begin(16, 2);irrecv.enableIRIn(); // запускаем модуль IR<br />&nbsp; audioChip.initialize(0,true);<br />&nbsp; pinMode(10,INPUT);// МЕНЮ КНОПКА SW энкодера<br />&nbsp; pinMode(11,INPUT);// ВЫБОР ВХОДА КНОПКА IN<br />&nbsp; ADMUX&nbsp; = 0b01100000; ADCSRA = 0b11010100; // <a href="http://rcl-radio.ru/?p=57478">http://rcl-radio.ru/?p=57478</a><br />&nbsp; MsTimer2::set(3, to_Timer);MsTimer2::start(); // АКТИВИРУЕМ ПРЕРЫВАНИЯ ДЛЯ ЭНКОДЕРА<br />&nbsp; vol = EEPROM.read(0);// vol eeprom <br />&nbsp; bass = EEPROM.read(1)-7;// bass eeprom<br />&nbsp; treb = EEPROM.read(3)-7;// treb eeprom<br />&nbsp; balans = EEPROM.read(4)-4;// balans eeprom<br />&nbsp; in = EEPROM.read(5);// in eeprom<br />&nbsp; gain0 = EEPROM.read(6);<br />&nbsp; gain1 = EEPROM.read(7);<br />&nbsp; gain2 = EEPROM.read(8);<br />&nbsp; audio();<br />}<br />void loop(){<br />&nbsp; &nbsp; &nbsp; if (newPosition != oldPosition) {if(spek==1){cl();menu=0;}}<br />&nbsp; if(spek==0){<br />&nbsp; &nbsp; &nbsp; byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};<br />&nbsp; &nbsp; &nbsp; byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};<br />&nbsp; &nbsp; &nbsp; byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};<br />&nbsp; &nbsp; &nbsp; lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);<br />&nbsp; &nbsp; }else{<br />&nbsp; &nbsp; &nbsp; byte v1[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v2[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b01110, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v4[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b01110, 0b01110, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v5[8] = {0b00000, 0b00000, 0b00000, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v6[8] = {0b00000, 0b00000, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v7[8] = {0b00000, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; byte v8[8] = {0b01110, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110, 0b01110};<br />&nbsp; &nbsp; &nbsp; 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);<br />&nbsp; &nbsp; &nbsp; }<br />&nbsp; ///////////////////// управление ////////////////////////////////////////////////////<br />&nbsp; &nbsp;if(digitalRead(10)==LOW){menu++;cl();;time=millis();w=1;w2=1;if(menu&gt;4){menu=0;}}// меню<br />&nbsp; &nbsp;if(digitalRead(11)==HIGH){in++;;cl();time=millis()-7000;w=1;w2=1;www=1;menu=4;if(in&gt;2){in=0;};audio();}// КНОПКА ВЫБОРА ВХОДА IN</p><p>&nbsp; &nbsp;////////////////// ИК приемник - обработка кодов кнопок ///////////////////////////////////////<br />&nbsp; if ( irrecv.decode( &amp;ir )) {Serial.print(&quot;0x&quot;);Serial.println( ir.value,HEX);irrecv.resume();time=millis();w=1;if(spek==1){menu=0;cl();}}// IR приемник - чтение, в мониторе порта отображаются коды кнопок</p><p>&nbsp; if(ir.value==0x2FDD02F){menu++;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu&gt;4){menu=0;}}// меню кнопка вверх<br />&nbsp; if(ir.value==0x2FD32CD){menu--;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu&lt;0){menu=4;}}// меню кнопка вниз<br />&nbsp; <br />&nbsp; if(ir.value==0x2FD708F){in++;cl();time=millis()-7000;w=1;w2=1;www=1;menu=4;if(in&gt;1){in=0;};gr1=0;gr2=0;audio();}// IN<br />&nbsp; <br /> /////////////////////// VOLUME //////////////<br />&nbsp; &nbsp;if(menu==0){<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FD906F){vol++;gr1=1;gr2=0;cl();w2=1;vol_func();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl();w2=1;vol_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FDF20D){vol--;gr1=0;gr2=1;cl();w2=1;vol_func();audio();}// кнопка &lt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl();w2=1;vol_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp;if (newPosition != oldPosition){oldPosition = newPosition;<br />&nbsp; &nbsp; &nbsp;vol=vol+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;vol_func();audio();} <br />&nbsp; &nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot;Volume&nbsp; &quot;);<br />&nbsp; &nbsp; &nbsp;lcd.print(&quot; &quot;);lcd.print(-62+vol);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);vol_d=vol-14;<br />&nbsp; &nbsp;if(w2==1){<br />&nbsp; &nbsp;for(z=0,z0=0,z1=0;z&lt;=vol_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}<br />&nbsp; &nbsp;if(z1==1){lcd.setCursor(z0,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1,1);lcd.print(&quot;&nbsp; &nbsp;&quot;);}}<br />&nbsp; &nbsp;if(z1==3){lcd.setCursor(z0,1);lcd.write((uint8_t)1);}<br />&nbsp; &nbsp;if(z1==2){lcd.setCursor(z0,1);lcd.write((uint8_t)2);}w2=0;}}</p><p>&nbsp; ///////////////////&nbsp; BASS&nbsp; //////////////<br />&nbsp; &nbsp;if(menu==1){<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FD906F){bass++;gr1=1;gr2=0;cl();w2=1;bass_func();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl();w2=1;bass_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FDF20D){bass--;gr1=0;gr2=1;cl();w2=1;bass_func();audio();}// кнопка &lt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl();w2=1;bass_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;&nbsp; <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp;if (newPosition != oldPosition) {<br />&nbsp; &nbsp; oldPosition = newPosition;<br />&nbsp; &nbsp; bass=bass+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;bass_func();audio();} <br />&nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot;Bass&nbsp; &nbsp; &quot;);<br />&nbsp; &nbsp;lcd.print(&quot; &quot;);lcd.print(bass*2);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);bass_d=bass*2+15;<br />&nbsp; &nbsp;if(w2==1){<br />&nbsp; &nbsp;for(z=0,z0=0,z1=0;z&lt;=bass_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}<br />&nbsp; &nbsp;if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+3,1);lcd.print(&quot;&nbsp; &nbsp;&quot;);}}<br />&nbsp; &nbsp;if(z1==3){lcd.setCursor(z0+3,1);lcd.write((uint8_t)1);}<br />&nbsp; &nbsp;if(z1==2){lcd.setCursor(z0+3,1);lcd.write((uint8_t)2);}w2=0;}}</p><p>&nbsp; ///////////////// TREBLE //////////////////<br />&nbsp; &nbsp;if(menu==2){<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FD906F){treb++;gr1=1;gr2=0;cl();w2=1;treb_func();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl();w2=1;treb_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FDF20D){treb--;gr1=0;gr2=1;cl();w2=1;treb_func();audio();}// кнопка &lt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl();w2=1;treb_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp;if (newPosition != oldPosition) {<br />&nbsp; &nbsp; oldPosition = newPosition;<br />&nbsp; &nbsp; treb=treb+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;treb_func();audio();} <br />&nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot;Treble&nbsp; &quot;);<br />&nbsp; &nbsp;lcd.print(&quot; &quot;);lcd.print(treb*2);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);treb_d=treb*2+15;<br />&nbsp; &nbsp;if(w2==1){<br />&nbsp; &nbsp;for(z=0,z0=0,z1=0;z&lt;=treb_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}<br />&nbsp; &nbsp;if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+3,1);lcd.print(&quot;&nbsp; &nbsp;&quot;);}}<br />&nbsp; &nbsp;if(z1==3){lcd.setCursor(z0+3,1);lcd.write((uint8_t)1);}<br />&nbsp; &nbsp;if(z1==2){lcd.setCursor(z0+3,1);lcd.write((uint8_t)2);}w2=0;}}</p><p>&nbsp; //////////////// BALANSE&nbsp; +\- 4 dB /////////////<br />&nbsp; &nbsp;if(menu==3){<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FD906F){balans++;gr1=1;gr2=0;cl();balans_func();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){balans++;gr2=0;cl();balans_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FDF20D){balans--;gr1=0;gr2=1;cl();balans_func();audio();}// кнопка &lt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){balans--;gr1=0;cl();balans_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if (newPosition != oldPosition) {<br />&nbsp; &nbsp; oldPosition = newPosition;<br />&nbsp; &nbsp; balans=balans+newPosition;myEnc.write(0);newPosition=0;lcd.clear();time=millis();w=1;balans_func();audio();}<br />&nbsp; lcd.setCursor(0,0);<br />&nbsp; &nbsp;if(balans&gt;=0){lcd.print(&quot;-&quot;);}else{lcd.print(&quot;+&quot;);}<br />&nbsp; lcd.print(abs(balans));lcd.print(&quot; dB &quot;);<br />&nbsp; if(balans==0){lcd.print(&quot; &lt;&gt;&nbsp; &quot;);}<br />&nbsp; if(balans&lt;0){lcd.print(&quot; &lt;&nbsp; &nbsp;&quot;);}<br />&nbsp; if(balans&gt;0){lcd.print(&quot;&nbsp; &gt;&nbsp; &quot;);}<br />&nbsp; &nbsp;if(balans&gt;=0){lcd.print(&quot;+&quot;);}else{lcd.print(&quot;-&quot;);}<br />&nbsp; lcd.print(abs(balans));lcd.print(&quot; dB &quot;);<br />&nbsp; lcd.setCursor(0,1);lcd.print(&quot;L&quot;);<br />&nbsp; lcd.setCursor(15,1);lcd.print(&quot;R&quot;);<br />&nbsp; &nbsp;if(balans&lt;0){lcd.setCursor(balans+7,1);lcd.write((uint8_t)0);}<br />&nbsp; &nbsp;if(balans&gt;0){lcd.setCursor(balans+8,1);lcd.write((uint8_t)0);}<br />&nbsp; &nbsp;if(balans==0){lcd.setCursor(7,1);lcd.write((uint8_t)0);lcd.setCursor(8,1);lcd.write((uint8_t)0);}}</p><p> /////////////////////////////////////////////////////////////</p><p>&nbsp; /////////// input + gain /////////////////////////////////////////<br /> if(menu==4){<br />&nbsp; &nbsp; &nbsp; &nbsp; switch(in){<br />&nbsp; &nbsp; &nbsp;case 0: gain = gain0;break;<br />&nbsp; &nbsp; &nbsp;case 1: gain = gain1;break;<br />&nbsp; &nbsp; &nbsp;case 2: gain = gain2;break;<br />&nbsp; &nbsp; &nbsp;}</p><p>&nbsp; &nbsp; &nbsp;if(ir.value==0x2FD906F){gain++;gr1=1;gr2=0;cl();time=millis();w=1;w2=1;gain_func();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){gain++;gr2=0;cl();time=millis();w=1;;w2=1;gain_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0x2FDF20D){gain--;gr1=0;gr2=1;cl();time=millis();w=1;w2=1;gain_func();audio();}// кнопка &lt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){gain--;gr1=0;cl();time=millis();w=1;w2=1;gain_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if (newPosition != oldPosition) {<br />&nbsp; &nbsp; oldPosition = newPosition;<br />&nbsp; &nbsp; gain=gain+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;gain_func();audio();} <br />&nbsp; &nbsp; <br />&nbsp; &nbsp;switch(in){<br />&nbsp; &nbsp; &nbsp;case 0: gain0 = gain;break;<br />&nbsp; &nbsp; &nbsp;case 1: gain1 = gain;break;<br />&nbsp; &nbsp; &nbsp;case 2: gain2 = gain;break;<br />&nbsp; &nbsp; &nbsp;} <br />&nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot; INPUT &quot;);lcd.print(in);<br />&nbsp; &nbsp;lcd.setCursor(0,1);lcd.print(&quot; GAIN &quot;);<br />&nbsp; &nbsp; &nbsp; switch(gain){<br />&nbsp; &nbsp; &nbsp; &nbsp; case 3: lcd.print(&quot; +11.25 dB&quot;);break;<br />&nbsp; &nbsp; &nbsp; &nbsp; case 2: lcd.print(&quot;&nbsp; &nbsp;+7.5 dB&quot;);break;<br />&nbsp; &nbsp; &nbsp; &nbsp; case 1: lcd.print(&quot;&nbsp; +3.75 dB&quot;);break;<br />&nbsp; &nbsp; &nbsp; &nbsp; case 0: lcd.print(&quot;&nbsp; &nbsp; &nbsp; 0 dB&quot;);break;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; }<br /> /////////////////////////////////////////////////////////////</p><p> // запись всех настроек в EEPROM если кнопки + и - не нажимались в течении 10 сек<br /> // если настройки тембра, баланса и номер входа не менялись в течении 10 сек, переход в рег. Громкости<br />&nbsp; &nbsp;if(millis()-time&gt;10000 &amp;&amp; w==1){<br />&nbsp; &nbsp; &nbsp;EEPROM.update(0,vol);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(4,balans+4);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(1,bass+7);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(3,treb+7);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(5,in);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(6,gain0); EEPROM.update(7,gain1); EEPROM.update(8,gain2);<br /> menu=100;lcd.clear();w=0;w2=1;cl();spek=1;<br /> }</p><p> if(spek==1){<br />&nbsp; analyzeAudio();&nbsp; &nbsp;// функция FHT, забивает массив fht_log_out[] величинами по спектру</p><p>&nbsp; for (int pos = 0; pos &lt; 16; pos++) {&nbsp; &nbsp;// для окошек дисплея с 0 по 15<br />&nbsp; &nbsp; // найти максимум из пачки тонов<br />&nbsp; &nbsp; if (fht_log_out[posOffset[pos]] &gt; maxValue) maxValue = fht_log_out[posOffset[pos]];</p><p>&nbsp; &nbsp; lcd.setCursor(pos, 0);</p><p>&nbsp; &nbsp; // преобразовать значение величины спектра в диапазон 0..15 с учётом настроек<br />&nbsp; &nbsp; int posLevel = map(fht_log_out[posOffset[pos]], LOW_PASS, gain_sp, 0, 15);<br />&nbsp; &nbsp; posLevel = constrain(posLevel, 0, 15);<br />&nbsp; while(yyy&lt;2){yyy++;<br />&nbsp; &nbsp; if (posLevel &gt; 7) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// если значение больше 7 (значит нижний квадратик будет полный)<br />&nbsp; &nbsp; &nbsp; lcd.write((uint8_t)posLevel - 8);&nbsp; &nbsp; // верхний квадратик залить тем что осталось<br />&nbsp; &nbsp; &nbsp; lcd.setCursor(pos, 1);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // перейти на нижний квадратик<br />&nbsp; &nbsp; &nbsp; lcd.write((uint8_t)7);&nbsp; &nbsp; &nbsp; &nbsp; // залить его полностью<br />&nbsp; } <br />&nbsp; &nbsp; else {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // если значение меньше 8<br />&nbsp; &nbsp; &nbsp; lcd.print(&quot; &quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// верхний квадратик пустой<br />&nbsp; &nbsp; &nbsp; lcd.setCursor(pos, 1);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // нижний квадратик<br />&nbsp; &nbsp; &nbsp; lcd.write((uint8_t)posLevel);&nbsp; &nbsp; &nbsp; &nbsp; // залить полосками<br />&nbsp; &nbsp; }} yyy=0;<br />&nbsp; }&nbsp; </p><p>&nbsp; if (AUTO_GAIN) {<br />&nbsp; &nbsp; maxValue_f = maxValue * k + maxValue_f * (1 - k);<br />&nbsp; &nbsp; if (millis() - gainTimer &gt; 1500) {&nbsp; &nbsp; &nbsp; // каждые 1500 мс<br />&nbsp; &nbsp; &nbsp; // если максимальное значение больше порога, взять его как максимум для отображения<br />&nbsp; &nbsp; &nbsp; if (maxValue_f &gt; VOL_THR) gain_sp = maxValue_f;</p><p>&nbsp; &nbsp; &nbsp; // если нет, то взять порог побольше, чтобы шумы вообще не проходили<br />&nbsp; &nbsp; &nbsp; else gain_sp = 100;<br />&nbsp; &nbsp; &nbsp; gainTimer = millis();<br />&nbsp; &nbsp; }<br />&nbsp; }else{gain_sp = DEF_GAIN;}<br />&nbsp; }<br />&nbsp; //////////////////////////////////</p><p>}// LOOP</p><p>void audio(){&nbsp; <br />&nbsp; audioChip.source(in);//select your source 1...3&nbsp; вход 3...1<br />&nbsp; audioChip.volume(vol);//Vol 0...62 шаг 1 дБ<br />&nbsp; audioChip.gain(gain);//gain 0...3 шаг 3.75 дБ<br />&nbsp; audioChip.bass(bass);//bass -7...+7 шаг 2 дБ<br />&nbsp; audioChip.treble(treb);//treble -7...+7 шаг 2 дБ<br />&nbsp; audioChip.balance(balans);//-31...+31 программно ограничено до +\-8 дБ<br />&nbsp; audioChip.loudness(true);//true or false // тонкомпенсация<br />}</p><p>void gain_func(){if(gain&lt;0){gain=3;}if(gain&gt;3){gain=0;}}<br />void balans_func(){if(balans&gt;4){balans=4;}if(balans&lt;-4){balans=-4;}}<br />void treb_func(){if(treb&gt;7){treb=7;}if(treb&lt;-7){treb=-7;}}<br />void bass_func(){if(bass&gt;7){bass=7;}if(bass&lt;-7){bass=-7;}} <br />void vol_func(){if(vol&lt;0){vol=0;}if(vol&gt;62){vol=62;}}<br />void cl(){ir.value=0;delay(300);spek=0;lcd.clear();}<br />void to_Timer(){newPosition = myEnc.read()/4;}</p><p>void analyzeAudio() {&nbsp; <br />&nbsp; cli(); <br /> while( i1 &lt; FHT_N ) {&nbsp; i1++; <br />&nbsp; &nbsp; do{ADCSRA |= (1 &lt;&lt; ADSC);} <br />&nbsp; &nbsp; while((ADCSRA &amp; (1 &lt;&lt; ADIF)) == 0);<br />&nbsp; &nbsp; fht_input[i1] = (ADCL|ADCH &lt;&lt; 8); <br />&nbsp; &nbsp; //fht_input[i1] = ADCH; <br />&nbsp; &nbsp; }i1=0;<br />&nbsp; &nbsp; fht_window(); // window the data for better frequency response<br />&nbsp; &nbsp; fht_reorder(); // reorder the data before doing the fht<br />&nbsp; &nbsp; fht_run(); // process the data in the fht<br />&nbsp; &nbsp; fht_mag_log(); // take the output of the fht<br />&nbsp; sei();<br />}</p>]]></content>
			<author>
				<name><![CDATA[antollik]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=3601</uri>
			</author>
			<updated>2025-09-06T22:56:07Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11905#p11905</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11440#p11440" />
			<content type="html"><![CDATA[<p>Переделал скетч под дисплей LCD0802. Микросхема PT7313E. Прислали китайцы вместо PT2313. Анализатора и ик пульта нету. Управление энкодер, кнопки: входов и mute. Если понадобиться, выложу.</p>]]></content>
			<author>
				<name><![CDATA[xfvlad]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2959</uri>
			</author>
			<updated>2025-02-28T17:42:56Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11440#p11440</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10648#p10648" />
			<content type="html"><![CDATA[<p>светодиод для дисплея и сделал фильтр по питанию из старого видика вырезал кусочек платы с дроселями по переменки который , пошел на крайние меры</p>]]></content>
			<author>
				<name><![CDATA[viktor11]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2637</uri>
			</author>
			<updated>2024-08-19T13:02:11Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10648#p10648</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10647#p10647" />
			<content type="html"><![CDATA[<p>спасибо , просто добавил в скетч включение светодиода при повороте энкоде , нажатий на пульт и кнопки входа, загорается на 8 сек и тухнет от бездействия на пине 13 и само отключение дисплея после 5 секунд бездействия<br />а анализатор тяму дать не могу удалить из кода</p>]]></content>
			<author>
				<name><![CDATA[viktor11]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2637</uri>
			</author>
			<updated>2024-08-19T13:00:57Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10647#p10647</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10646#p10646" />
			<content type="html"><![CDATA[<p>Найдите строку </p><p>menu=100;lcd.clear();w=0;w2=1;cl();spek=1;</p><p>замените на </p><p> menu=100;lcd.clear();w=0;w2=1;cl();spek=0;</p><p>анализатор должен перестать работать</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-08-19T12:56:45Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10646#p10646</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10645#p10645" />
			<content type="html"><![CDATA[<p>Привет всем, у меня вопрос можно ли удалить вообще спектранализ? и есть ли решение по свисту от бп , кто что использует? заранее спасибо</p>]]></content>
			<author>
				<name><![CDATA[viktor11]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2637</uri>
			</author>
			<updated>2024-08-19T11:38:16Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10645#p10645</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10643#p10643" />
			<content type="html"><![CDATA[<p>спасибо бошльшое за помощь , оказалось дело в pt было купил новую и все заработало</p>]]></content>
			<author>
				<name><![CDATA[viktor11]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2637</uri>
			</author>
			<updated>2024-08-17T12:29:06Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10643#p10643</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10642#p10642" />
			<content type="html"><![CDATA[<p>PT2313 вроде рабочая, контроллер видит микросхему.<br />Пролистайте все настройки, громкость тембр и тд, посмотрите что бы все настройки были в нужных пределах. Информацию о настройках контроллер берез из памяти, значения которых могут выходить за пределы настроек при первом включении.</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-08-17T04:20:26Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10642#p10642</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10641#p10641" />
			<content type="html"><![CDATA[<p>11:03:40.000 -&gt; Scanning...<br />11:03:40.000 -&gt; I2C device found at address 0x44 !<br />11:03:40.000 -&gt; done<br />11:03:40.000 -&gt;</p>]]></content>
			<author>
				<name><![CDATA[viktor11]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2637</uri>
			</author>
			<updated>2024-08-17T04:02:17Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10641#p10641</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10640#p10640" />
			<content type="html"><![CDATA[<p><a href="http://forum.rcl-radio.ru/viewtopic.php?id=64">http://forum.rcl-radio.ru/viewtopic.php?id=64</a></p><p>I2C сканер загрузите, посмотрите какие i2c адреса определятся</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-08-17T03:26:25Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10640#p10640</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PT2313 + энкодер + ИК пульт + анализатор спектра]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10639#p10639" />
			<content type="html"><![CDATA[<p>Привет всем , есть вопрос собрал все по инструкций но есть проблема . При изменений громкости ее нет ,а только щелчки так же и с тембрами . Помогите пожалуйста очень хочу собрать но толку не дам этому</p>]]></content>
			<author>
				<name><![CDATA[viktor11]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2637</uri>
			</author>
			<updated>2024-08-17T02:14:59Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10639#p10639</id>
		</entry>
</feed>
