<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; TDA8425 + энкодер + пульт + STANDBY]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=57&amp;type=atom" />
	<updated>2025-10-16T11:49:34Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=57</id>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11949#p11949" />
			<content type="html"><![CDATA[<p><strong>Redpanter</strong>, прикольно.<br />Спасибо за труды.<br />Можно видео как работает?</p>]]></content>
			<author>
				<name><![CDATA[Karl2233]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1733</uri>
			</author>
			<updated>2025-10-16T11:49:34Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11949#p11949</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=11931#p11931" />
			<content type="html"><![CDATA[<p>Здравствуйте уважаемый <strong>liman324</strong>, спасибо за Ваши работы! На основе ваших статей попытался сделать свою, упрощенную версию темброблока для настольной микросистемы на TDA8425! В этой версии отсутствует управление пультом, анализатор спектра заменен на индикатор уровня сигнала, немного изменен интерфейс контроля темброблока, и добавлено светодиодное кольцо, для отображения регулировки уровня громкости и индикации уровня сигнала.<br />Прощу меня&nbsp; простить, я совсем не разбираюсь в программировании, свою версию сделал на основе анализа написанного кода, в основном из Ваших статей, и примеров из интернета, поэтому там, наверное, все криво - косо соединено, не судите строго! Код вроде бы работает, проверил на Ардуино Нано, и на LGT8F328P Нано, поэтому оставлю код в этой теме, может быть кому-нибудь пригодится!</p><p>Собственно, сам код!</p><div class="codebox"><pre><code>#define LED_PIN 13      // пин светодиодного кольца
#define NUMPIXELS 12    // кол-во светодиодов
#define DELAYPIXEL 500  // время (в миллисекундах) для паузы между пикселями

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

#define SW 10   // пин кнопки энкодера
#define CLK 11   // пин CLK энкодера
#define DT 12    // пин DT энкодера
#define MUT 9    // пин кнопки mute
#define DB 8     // пин кнопки -20 dB

#define EE_DATA_ADDR 1  // Адрес хранения настроек
#define EE_KEY_ADDR 0   // Адрес Хранения ключа ЕЕПРОМ
#define EE_KEY 0xBE     // Ключ

#include &lt;LiquidCrystal.h&gt;
#include &lt;Wire.h&gt;
#include &lt;TDA8425.h&gt;
#include &lt;Encoder.h&gt;
#include &lt;EEPROM.h&gt;
// #include &lt;EEPROMex.h&gt;
#include &lt;MsTimer2.h&gt;
#include &lt;Adafruit_NeoPixel.h&gt;
#include &lt;FastLED.h&gt;

LiquidCrystal lcd(7, 6, 2, 3, 4, 5);  // активация RS,E,D4,D5,D6,D7 LCD
Encoder myEnc(CLK, DT);               // активация CLK, DT энкодера 
TDA8425 tda;



int a[2];
unsigned long oldPosition  = -999,newPosition,time;
uint8_t d1,d2,d3,d4,d5,d6,e1,e2,e3;
int ur, ul, urr, ull, urrr, ulll, x, i, is, u_maxr, u_maxl, u_l0[20], u_r0[20];

int z, vol_d, bass_d, treb_d, sss, sp, db;
uint8_t zy, zy0, zy1, w;
uint8_t www, www1, spek, menu, w1, w2, mute, y;

struct {  // Структура с переменными - параметрами звука и стилями шрифтов
  int sped = 0;
  int vol = 40;
  int8_t bass = 0;
  int8_t treb = 0;
  int8_t balans = 0;
  uint8_t graf = 0;
  uint8_t in = 0;
  uint8_t font = 0;
} data;

void to_Timer() {  //функция таймера
  newPosition = myEnc.read() / 6;
}

Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);  //параметры светодиодной ленты

void setup() {
 Serial.begin(9600);
  lcd.begin(16, 2);  // LCD 16X2
  lcd.clear();       // Очистка дисплея
  ADMUX = 0b11100000;
  //ADCSRA = 0b11110011;
  if (EEPROM.read(EE_KEY_ADDR) != EE_KEY) {  // Проверяем ключ ЕЕПРОМ, и если не совпадает
    EEPROM.put(EE_DATA_ADDR, data);          // Это - первый запуск, установка всех настроек по умолчанию
    EEPROM.write(EE_KEY_ADDR, EE_KEY);       // Пишем ключ
  }
 // 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);
  pinMode(A0, INPUT);              // A0 - аналоговый вход R
  pinMode(A1, INPUT);              // A1 - аналоговый вход L
  pinMode(SW, INPUT);              // Меню кнопка энкодера SW
  pinMode(9, INPUT);               // Кнопка mute
  pinMode(8, INPUT);               // Кнопка -20 dB
  EEPROM.get(EE_DATA_ADDR, data);  // Читаем ЕЕПРОМ настройки
  audio();
  pixels.begin();  // Инициализируем объект NeoPixel
  pixels.setBrightness(5);
  pixels.clear();

  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.

  lcd.setCursor(1, 0);
  lcd.print(F(&quot;| ELECTRONIC |&quot;));
  lcd.setCursor(1, 1);
  lcd.print(F(&quot;|   KETTLE   |&quot;));
  pixelStart();
  MsTimer2::set(1, to_Timer);
  MsTimer2::start();
  lcd.clear();
}


void loop() {
if (spek == 1) {
    if (www == 1) {
      if (data.graf == 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 (data.graf == 1) {
        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 (data.graf == 2) {
        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 (data.graf == 3) {
        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 (data.graf == 4) {
        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);
      }
      www = 0;
    }
    urr = log(analogRead(0)) * GAIN;
    if (urr &gt; 41) { urr = 41; }
    ull = log(analogRead(1)) * GAIN;
    if (ull &gt; 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(F(&quot;L&quot;));
      lcd.setCursor(0, 0);
      lcd.print(F(&quot;R&quot;));
    }

    if (urr &lt; ur) {
      ur = ur - 1;
      delay(STEP);
    } else {
      ur = urr;
    }
    for (zy = 0, zy0 = 0, zy1 = 0; zy &lt;= ur; zy++, zy1++) {
      if (zy1 &gt; 2) {
        zy1 = 0;
        zy0++;
      }
      if (zy1 == 1) {
        lcd.setCursor(zy0 + 1, 1);
        lcd.write((uint8_t)0);
        lcd.setCursor(zy0 + 2, 1);
        if (ur &lt; 39) { lcd.print(F(&quot; &quot;)); }
      }
    }
    if (zy1 == 3) {
      lcd.setCursor(zy0 + 1, 1);
      lcd.write((uint8_t)1);
    }
    if (zy1 == 2) {
      lcd.setCursor(zy0 + 1, 1);
      lcd.write((uint8_t)2);
    }

    if (ull &lt; ul) {
      ul = ul - 1;
      delay(STEP);
    } else {
      ul = ull;
    }
    for (zy = 0, zy0 = 0, zy1 = 0; zy &lt;= ul; zy++, zy1++) {
      if (zy1 &gt; 2) {
        zy1 = 0;
        zy0++;
      }
      if (zy1 == 1) {
        lcd.setCursor(zy0 + 1, 0);
        lcd.write((uint8_t)0);
        lcd.setCursor(zy0 + 2, 0);
        if (ul &lt; 39) { lcd.print(F(&quot; &quot;)); }
      }
    }
    if (zy1 == 3) {
      lcd.setCursor(zy0 + 1, 0);
      lcd.write((uint8_t)1);
    }
    if (zy1 == 2) {
      lcd.setCursor(zy0 + 1, 0);
      lcd.write((uint8_t)2);
    }

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

    i++;
    if (i &lt; 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 &lt;= 15; x++) {
        u_maxl = max(u_maxl, u_l0[x]);
        u_maxr = max(u_maxr, u_r0[x]);
      }
    }

    if (u_maxl &lt; ulll) {
      ulll = ulll - 1;
    } else {
      ulll = u_maxl;
    }
    if (u_maxr &lt; urrr) {
      urrr = urrr - 1;
    } else {
      urrr = u_maxr;
    }

    if (u_maxl &lt;= ull) { u_maxl = ull + 1; }
    if (u_maxr &lt;= urr) { u_maxr = urr + 1; }

    lcd.setCursor(ulll / 3 + 1, 0);
    if (ulll / 3 &gt; 2) { lcd.write((uint8_t)6); }
    lcd.print(F(&quot;  &quot;));
    lcd.setCursor(urrr / 3 + 1, 1);
    if (urrr / 3 &gt; 2) { lcd.write((uint8_t)6); }
    lcd.print(F(&quot;  &quot;));
    pixelVUmetr();

    delay(3);
    // spektr
  }

if(digitalRead(SW)==LOW&amp;&amp;menu&lt;6){sss++;if(spek==1){menu==0;lcd.clear();}else{menu++;lcd.clear();}www1=0;spek=0;myEnc.write(0);oldPosition  = -999;delay(300);time=millis();w1=1;}if(menu&gt;6){menu=0;lcd.clear();pixels.clear();}// меню
   if(digitalRead(SW)==HIGH){sss=0;}
   //if(menu==3&amp;&amp;digitalRead(12)==LOW&amp;&amp;sss==0){menu=4;oldPosition  = -999;delay(300);time=millis();w1=1;lcd.clear();}
   //if(menu==4&amp;&amp;digitalRead(12)==LOW&amp;&amp;sss==0){menu=5;oldPosition  = -999;delay(300);time=millis();w1=1;lcd.clear();}
   if(menu==6&amp;&amp;digitalRead(SW)==LOW){menu=0;time=millis();w1=1;delay(300);lcd.clear();pixels.clear();}
   if(menu&gt;6&amp;&amp;digitalRead(SW)==HIGH){menu=0;time=millis();w1=1;delay(300);lcd.clear();pixels.clear();}
   if (newPosition != oldPosition&amp;&amp;spek==1) {oldPosition = newPosition;menu=0,www1=0;spek=0;w1=1;time=millis();lcd.clear();pixels.clear();}

  if (spek == 0) {
    if (www1 == 0) {
      byte a1[8] = { 0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b00000 };
      byte a2[8] = { 0b00000, 0b11000, 0b11000, 0b11000, 0b11000, 0b11000, 0b11000, 0b00000 };
      lcd.createChar(0, a1);
      lcd.createChar(1, a2);
      www1 = 1;
    }

    ///////////////////////// громкость /////////////////////////////
    if (menu == 0) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        data.vol = data.vol + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
        lcd.clear();
        pixels.clear();
        time = millis();
        w1 = 1;
        
        if (data.vol &gt; 63) { data.vol = 63; }
        if (data.vol &lt; 16) { data.vol = 16; }
      }
	  
    /*byte a1[8] = { 0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b00000 };
    byte a2[8] = { 0b00000, 0b11000, 0b11000, 0b11000, 0b11000, 0b11000, 0b11000, 0b00000 };
    lcd.createChar(0, a1);
    lcd.createChar(1, a2);*/
    lcd.setCursor(0, 0);
    lcd.print(F(&quot;VOLUME &quot;));
    vol_d = data.vol * 2 - 120;
	
    if (vol_d &gt;= 0) {
      lcd.setCursor(7, 1);
      lcd.print(F(&quot;+&quot;));
    } else {
      lcd.setCursor(7, 1);
      lcd.print(F(&quot;-&quot;));
    }
    /*if (vol_d &gt; -10) {
      lcd.print(F(&quot; &quot;));
      }*/
    //lcd.print(abs(vol_d));
    fontDatabase();
    a[0]=(abs(vol_d)/10)%10;a[1]=(abs(vol_d))%10;
    lcd.setCursor(14, 1);
    lcd.print(F(&quot;dB&quot;));
      // ползунок громкости начинает работать с -56 дБ
    /*if (data.vol - 32 &gt; 0) {
      for (z = 0; z &lt;= data.vol - 33; z++) {
         lcd.setCursor(z / 2, 1);
         lcd.write((uint8_t)0);
      }
    }
    if ((data.vol - 32) % 2 == 0 &amp;&amp; data.vol - 32 &gt;= 0) {
        lcd.setCursor(z / 2, 1);
        lcd.write((uint8_t)1);
    }*/  
    float z_gl;
    if (data.vol - 32 &gt; 0) {
      if (z_gl + 1 &gt; 7) {z_gl = 7;}
        for (z_gl = 0; z_gl &lt;= data.vol - 33; z_gl++) {
         lcd.setCursor(z_gl / 4.57, 1);
         lcd.write((uint8_t)161);
         /*lcd.setCursor(z_gl / 4.57 + 1, 1);
         lcd.write((uint8_t)32);*/
      }
    }
    pixelVolume();
    audio();
    }
    ///////////////////////// баланс /////////////////////////////
    if (menu == 1) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        data.balans = data.balans + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
		pixelVUmetr();
        lcd.clear();
        time = millis();
        w1 = 1;
        if (data.balans &gt; 4) { data.balans = 4; }
        if (data.balans &lt; -4) { data.balans = -4; }
      }

      lcd.setCursor(0, 0);
      if (data.balans * 2 &gt;= 0) {
        lcd.print(F(&quot;-&quot;));
      } else {
        lcd.print(F(&quot;+&quot;));
      }
      lcd.print(abs(data.balans * 2));
      lcd.print(F(&quot; dB &quot;));
      lcd.print(F(&quot; &lt;&gt;  &quot;));
      if (data.balans * 2 &gt;= 0) {
        lcd.print(F(&quot;+&quot;));
      } else {
        lcd.print(F(&quot;-&quot;));
      }
      lcd.print(abs(data.balans * 2));
      lcd.print(F(&quot; dB &quot;));
      lcd.setCursor(0, 1);
      lcd.print(F(&quot;L&quot;));
      lcd.setCursor(15, 1);
      lcd.print(F(&quot;R&quot;));
      if (data.balans &lt; 0) {
        lcd.setCursor(data.balans + 7, 1);
        lcd.write((uint8_t)161);
      }
      if (data.balans &gt; 0) {
        lcd.setCursor(data.balans + 8, 1);
        lcd.write((uint8_t)161);
      }
      if (data.balans == 0) {
        lcd.setCursor(7, 1);
        lcd.write((uint8_t)0);
        lcd.setCursor(8, 1);
        lcd.write((uint8_t)0);
      }
      audio();
    }
    ///////////////////////// тембр нч /////////////////////////////
    if (menu == 2) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        data.bass = data.bass + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
        //lcd.clear();
        pixelVUmetr();
        time = millis();
        w1 = 1;
        if (data.bass &gt; 11) { data.bass = 11; }
        if (data.bass &lt; 2) { data.bass = 2; }
      }

      lcd.setCursor(0, 0);
      lcd.print(F(&quot;BASS&quot;));
      bass_d = data.bass * 3 - 18;
      if (bass_d &gt;= 0) {
        lcd.setCursor(7, 1);
        lcd.print(F(&quot;+&quot;));
      } else {
        lcd.setCursor(7, 1);
        lcd.print(F(&quot;-&quot;));
      }
      /*if (bass_d &gt; -10 &amp;&amp; bass_d &lt;= 0 || bass_d &lt; 10 &amp;&amp; bass_d &gt; 0) {
        lcd.print(F(&quot; &quot;));
      }*/
      //lcd.print(abs(bass_d));
      fontDatabase();
      a[0]=(abs(bass_d)/10)%10;a[1]=(abs(bass_d))%10;
      lcd.setCursor(14, 1);
      lcd.print(F(&quot;dB&quot;));
      /*if (data.bass &gt; 1) {
        for (z = 3; z &lt;= data.bass + 1; z++) {
          lcd.setCursor(z, 1);
          lcd.write((uint8_t)0);
        }
      }*/
      audio();
    }
    ///////////////////////// тембр вч /////////////////////////////
    if (menu == 3) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        data.treb = data.treb + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
        //lcd.clear();
        pixelVUmetr();
        time = millis();
        w1 = 1;
        if (data.treb &gt; 11) { data.treb = 11; }
        if (data.treb &lt; 2) { data.treb = 2; }
      }

      if (data.treb &gt; 10) { data.treb = 10; }
      if (data.treb &lt; 2 || data.treb == 255) { data.treb = 2; }
      lcd.setCursor(0, 0);
      lcd.print(F(&quot;TREBLE&quot;));
      treb_d = data.treb * 3 - 18;
      if (treb_d &gt;= 0) {
        lcd.setCursor(7, 1);
        lcd.print(F(&quot;+&quot;));
      } else {
        lcd.setCursor(7, 1);
        lcd.print(F(&quot;-&quot;));
      }
      /*if (treb_d &gt; -10 &amp;&amp; treb_d &lt;= 0 || treb_d &lt; 10 &amp;&amp; treb_d &gt; 0) {
        lcd.print(F(&quot; &quot;));
      }*/
      //lcd.print(abs(treb_d));
      fontDatabase();
      a[0]=(abs(treb_d)/10)%10;a[1]=(abs(treb_d))%10;
      lcd.setCursor(14, 1);
      lcd.print(F(&quot;dB&quot;));
      /*if (data.treb &gt; 1) {
        for (z = 3; z &lt;= data.treb + 1; z++) {
          lcd.setCursor(z, 1);
          lcd.write((uint8_t)0);
        }
      }*/
      audio();
    }
    ///////////////////////// input /////////////////////////////
    if (menu == 4) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        data.in = data.in + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
        //lcd.clear();
        pixelVUmetr();
        time = millis();
        w1 = 1;
        if (data.in &gt; 1) {
          data.in = 0;
        }
        if (data.in &lt; 0) {
          data.in = 1;
        }
    
      }
      lcd.setCursor(0, 0);
      lcd.print(F(&quot;SOURCE&quot;));
      lcd.setCursor(0, 1);
      lcd.print(F(&quot;Input: &quot;));
      if (data.in == 0) {
        lcd.print(F(&quot;AUX      &quot;));
      } else {
        lcd.print(F(&quot;Bluetooth&quot;));
      }
      audio();
    }
///////////////////////// spectrum analyzer /////////////////////////////
    if (menu == 5) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        w1 = 0;
        data.graf = data.graf + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
        //lcd.clear();
        pixelVUmetr();
        time = millis();
        w1 = 1;
      }
        fontDatabase();
        if (data.graf &gt; 4) {
          data.graf = 0;
        }
        if (data.graf &lt; 0) {
          data.graf = 4;
        }
        lcd.setCursor(0, 0);
        lcd.print(F(&quot;VU MET&quot;));
        lcd.setCursor(0, 1);
        lcd.print(F(&quot;Graph.&quot;));
        a[0]=data.graf/10%10;a[1]=data.graf%10;
      
    }
    /////////////////////////////////////////////////////////////////////////
    
    ///////////////////////// Шрифт /////////////////////////////
    if (menu == 6) {
      if (newPosition != oldPosition) {
        oldPosition = newPosition;
        w1 = 0;
        data.font = data.font + newPosition;
        myEnc.write(0);
        newPosition = 0;
        audio();
        //lcd.clear();
        pixelVUmetr();
        time = millis();
        w1 = 1;
      }
      fontDatabase();
      if (data.font &gt; 1) {
          data.font = 0;
      }
      if (data.font &lt; 0) {
          data.font = 1;
      }
         
		lcd.setCursor(0, 0);
        lcd.print(F(&quot;FONT&quot;));
	    a[0]=data.font/10%10;a[1]=data.font%10;
    }
    /////////////////////////////////////////////////////////////////////////
    
  }  // spek = 0
  if (w2 == 0) {
    switch (data.sped) {
      case 0: ADCSRA = 0b11110010; break;
      case 1: ADCSRA = 0b11110011; break;
      case 2: ADCSRA = 0b11110100; break;
      case 3: ADCSRA = 0b11110101; break;
      case 4: ADCSRA = 0b11110110; break;
      case 5: ADCSRA = 0b11110111; break;
    }
    w2 = 1;
  }

  ////////////////// mute //////////////////////////////////
  if (digitalRead(MUT) == HIGH &amp;&amp; menu != 5) {
    mute++;
    if (mute &gt; 1) {
      mute = 0;
    }
    if (mute == 1) {
      menu = -1;
      w1 = 0;
      spek = 0;
      www1 = 0;
    } else {
      oldPosition = -999;
      menu = 0;
    }
    audio();
    delay(300);
    lcd.clear();
    lcd.setCursor(6, 0);
    lcd.print(F(&quot;MUTE&quot;));
  }
  ///////////////////////////////////////////////////////////

  ///////////////////  -20 dB ///////////////////////////////
  if (digitalRead(DB) == HIGH &amp;&amp; db == 0) {
    data.vol = data.vol - 10;
    db = 1;
    delay(500);
    audio();
    myEnc.write(0);
    menu = 0;
    lcd.clear();
  }
  if (digitalRead(8) == HIGH &amp;&amp; db == 1) {
    data.vol = data.vol + 10;
    db = 0;
    delay(500);
    audio();
    myEnc.write(0);
    menu = 0;
    lcd.clear();
  }
  //////////////////////////////////////////////////////////


  if (millis() - time &gt; 10000 &amp;&amp; w1 == 1) {  // сохранение всех настроек в eeprom через 10 сек неактивности
    EEPROM.put(EE_DATA_ADDR, data);          // Пишем настройки
    w1 = 0;
    menu = 0;
    lcd.clear();
    spek = 1;
    www = 1;
    sp = 0;
  }
}  // конец цикла loop

void audio() {
  tda.setVolumeL(data.vol + data.balans);
  tda.setVolumeR(data.vol - data.balans);
  tda.setBass(data.bass);
  tda.setTreble(data.treb);
  tda.setMute(mute);
  tda.setSource(data.in);
}

void pixelStart() {
  for (int i = 0; i &lt; NUMPIXELS; i++) {  // Для каждого пикселя...
    delay(DELAYPIXEL);  // Пауза перед следующим проходом через цикл
    // Pixels.Color() принимает значения RGB от 0,0,0 до 255,255,255
    // Здесь мы используем голубой цвет:
    pixels.setPixelColor(i, 0, 0, 250);
    pixels.show();      // Отправляем информацию на ленту
    if (i == NUMPIXELS - 1) break;
    
  } 
}

void pixelVolume() {
  float z_pl;
  if (newPosition != oldPosition) {
    oldPosition = newPosition;
    data.vol = data.vol + newPosition;
    myEnc.write(0);
    newPosition = 0;
    time = millis();
  }
  if ((data.vol - 32) &lt;= 0) {z_pl = 0;
    pixels.setPixelColor(0, 0, 0, 250);
    pixels.show();
    delay(1);
  }
  if ((data.vol - 32) &gt; 0) {
       z_pl &gt; 0;
    for (z_pl = 0; z_pl &lt;= (data.vol - 33); z_pl++) {
      pixels.setPixelColor(z_pl / 2.6, 0, 0, 250);
      pixels.show();
      delay(1);
      pixels.setPixelColor(z_pl / 2.6 + 1, 0, 0, 0);
      pixels.show();
      delay(1);
    }
  }
}

void pixelVUmetr() {
  int ulp = ull / 4;
  int ul_p;
  if (ulp &gt; 12) { ulp = 12; }
  if (ulp &lt; ul_p) {
    ul_p = ul_p - 1;
  } else {
    ul_p = ulp;
  }
  for (zy = 0; zy &lt;= ul_p; zy++) {
    pixels.setPixelColor(zy + 1, 0, 0, 250);
    pixels.show();
    delay(STEP);
    if (ul_p &lt; 10) {
      pixels.setPixelColor(zy + 2, 0, 0, 0);
      pixels.show();
      delay(STEP);
    }
  }
}

void fontDatabase (){  // база данных шрифтов
  
  uint8_t customChar1[8] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
uint8_t customChar2[8] = {
  B11111,
  B11111,
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000
};
uint8_t customChar3[8] = {
  B11111,
  B11111,
  B11111,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111
};
uint8_t customChar4[8] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111,
  B11111
};
uint8_t customChar5[8] = {
  B00111,
  B01111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
uint8_t customChar6[8] = {
  B11100,
  B11110,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
uint8_t customChar7[8] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B01111,
  B00111
};
uint8_t customChar8[8] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11110,
  B11100
};

uint8_t v1[8] = {0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07};
uint8_t v2[8] = {0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00};      
uint8_t v3[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F};
uint8_t v4[8] = {0x1F,0x1F,0x00,0x00,0x00,0x00,0x1F,0x1F};
uint8_t v5[8] = {0x1C,0x1C,0x00,0x00,0x00,0x00,0x1C,0x1C};
uint8_t v6[8] = {0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C};
uint8_t v7[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07};
uint8_t v8[8] = {0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00};
  
  if (data.font==0){lcd.createChar(1, customChar1);lcd.createChar(2, customChar2);lcd.createChar(3, customChar3);
  lcd.createChar(4, customChar4);lcd.createChar(5, customChar5);lcd.createChar(6, customChar6);
  lcd.createChar(7, customChar7);lcd.createChar(8, customChar8);

  for(int is=0;is&lt;3;is++){
      switch(is){
        case 0: e1=8,e2=9,e3=10;break;    // столбец десятков
        case 1: e1=11,e2=12,e3=13;break;  // столбец едениц
        }
      switch(a[is]){
        case 0: d1=5,d2=2,d3=6,
		        d4=7,d5=4,d6=8;break;         // Цифра 0
        case 1: d1=32,d2=2,d3=6,
		        d4=32,d5=32,d6=1;break;       // Цифра 1
        case 2: d1=3,d2=3,d3=6,
		        d4=7,d5=4,d6=4;break;         // Цифра 2
        case 3: d1=2,d2=3,d3=6,
		        d4=4,d5=4,d6=8;break;         // Цифра 3
        case 4: d1=7,d2=4,d3=1,
		        d4=32,d5=32,d6=1;break;       // Цифра 4
        case 5: d1=5,d2=3,d3=3,
		        d4=4,d5=4,d6=8;break;         // Цифра 5
        case 6: d1=5,d2=3,d3=3,
		        d4=7,d5=4,d6=8;break;         // Цифра 6
        case 7: d1=2,d2=2,d3=6,
		        d4=32,d5=32,d6=1;break;       // Цифра 7
        case 8: d1=5,d2=3,d3=6,
		        d4=7,d5=4,d6=8;break;         // Цифра 8
        case 9: d1=5,d2=3,d3=6,
		        d4=4,d5=4,d6=8;break;         // Цифра 9
    }
      lcd.setCursor(e1,0);lcd.write((uint8_t)d1);lcd.setCursor(e2,0);lcd.write((uint8_t)d2);lcd.setCursor(e3,0);lcd.write((uint8_t)d3);
      lcd.setCursor(e1,1);lcd.write((uint8_t)d4);lcd.setCursor(e2,1);lcd.write((uint8_t)d5);lcd.setCursor(e3,1);lcd.write((uint8_t)d6);}
      }
else {
  lcd.createChar(1, v1);lcd.createChar(2, v2);lcd.createChar(3, v3);
  lcd.createChar(4, v4);lcd.createChar(5, v5);lcd.createChar(6, v6);
  lcd.createChar(7, v7);lcd.createChar(8, v8);

  for(int is=0;is&lt;3;is++){
      switch(is){
        case 0: e1=8,e2=9,e3=10;break;                     // столбец десятков
        case 1: e1=11,e2=12,e3=13;break;                   // столбец едениц
        }
      switch(a[is]){
        case 0: d1=1,d2=8,d3=6,d4=1,d5=3,d6=6;break;       // цифры 1-9
        case 1: d1=32,d2=2,d3=6,d4=32,d5=32,d6=6;break;
        case 2: d1=2,d2=8,d3=6,d4=1,d5=4,d6=5;break;
        case 3: d1=2,d2=4,d3=6,d4=7,d5=3,d6=6;break;
        case 4: d1=1,d2=3,d3=6,d4=32,d5=32,d6=6;break;
        case 5: d1=1,d2=4,d3=5,d4=7,d5=3,d6=6;break;
        case 6: d1=1,d2=4,d3=5,d4=1,d5=3,d6=6;break;
        case 7: d1=1,d2=8,d3=6,d4=32,d5=32,d6=6;break;
        case 8: d1=1,d2=4,d3=6,d4=1,d5=3,d6=6;break;
        case 9: d1=1,d2=4,d3=6,d4=7,d5=3,d6=6;break;
    }
      lcd.setCursor(e1,0);lcd.write((uint8_t)d1);lcd.setCursor(e2,0);lcd.write((uint8_t)d2);lcd.setCursor(e3,0);lcd.write((uint8_t)d3);
      lcd.setCursor(e1,1);lcd.write((uint8_t)d4);lcd.setCursor(e2,1);lcd.write((uint8_t)d5);lcd.setCursor(e3,1);lcd.write((uint8_t)d6);
 }}
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Redpanter]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=3911</uri>
			</author>
			<updated>2025-10-12T14:02:55Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=11931#p11931</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10730#p10730" />
			<content type="html"><![CDATA[<p>Cambie el codificador, continua el ruido. El cableado a tierra parece correcto. !</p>]]></content>
			<author>
				<name><![CDATA[msanfelipe133]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1804</uri>
			</author>
			<updated>2024-09-04T20:21:20Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10730#p10730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10729#p10729" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Cual sera el error de programacion ?.</p></blockquote></div><p>Разводка земли, помехи от индикатора?</p>]]></content>
			<author>
				<name><![CDATA[Karl2233]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1733</uri>
			</author>
			<updated>2024-09-04T18:22:20Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10729#p10729</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10728#p10728" />
			<content type="html"><![CDATA[<p>Hola , excelente foro. Estoy trabajando en este proyecto tda 8425 , arduino y amplificador tda 7297. Cada fuente esta separada con un modulo aislador dc dc. Funciona , pero observo de fondo un ruido que solo desaparece cuando el volumen es cero (0) dB. Hacia arriba o hacia abajo existe un ruido de fondo. Cual sera el error de programacion ?. Gracias</p><br /><br /><br /><p> #include &lt;Wire.h&gt;<br />&nbsp; #include &lt;TDA8425.h&gt;<br />&nbsp; #include &lt;Encoder.h&gt;<br />&nbsp; #include &lt;LiquidCrystal_I2C.h&gt;<br />&nbsp; #include &lt;EEPROM.h&gt;<br />&nbsp; #include &lt;MsTimer2.h&gt;<br />&nbsp; #include &lt;boarddefs.h&gt;<br />&nbsp; #include &lt;IRremote.h&gt;<br />&nbsp; &nbsp;IRrecv irrecv(9); // указываем вывод модуля IR приемника<br />&nbsp; &nbsp;Encoder myEnc(11, 10);//CLK, DT<br />&nbsp; &nbsp;decode_results ir;<br />&nbsp; &nbsp;TDA8425 tda;<br />&nbsp; LiquidCrystal_I2C lcd(0x27,16,2);<br />&nbsp; &nbsp; byte a1[8]={0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101};<br />&nbsp; &nbsp; byte a2[8]={0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100};<br />&nbsp; &nbsp; byte a3[8]={0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000};<br />&nbsp; &nbsp;int menu,vol,vol_d,balans,bass,bass_d,treb,treb_d,in,mute,sss;<br />&nbsp; &nbsp;byte w,w2,standby=1,www,z,z0,z1,gr1,gr2;<br />&nbsp; &nbsp;unsigned long time,oldPosition&nbsp; = -999,newPosition;</p><p>void setup() {<br />&nbsp; &nbsp;Serial.begin(9600);lcd.begin(16, 2);lcd.clear();lcd.backlight();<br />&nbsp; &nbsp;irrecv.enableIRIn(); // запускаем модуль IR<br />&nbsp; &nbsp;pinMode(12,INPUT);// меню кнопка энкодера SW<br />&nbsp; &nbsp;pinMode(A0,INPUT);// кнопка POWER<br />&nbsp; &nbsp;pinMode(8,OUTPUT);// выход управления STANDBY<br />&nbsp; &nbsp;pinMode(A1,INPUT);// MUTE<br />&nbsp; &nbsp;digitalWrite(8,LOW);<br />&nbsp; &nbsp;lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);<br />&nbsp; &nbsp;vol = EEPROM.read(0);// vol eeprom<br />&nbsp; &nbsp;bass = EEPROM.read(1);// bass eeprom<br />&nbsp; &nbsp;treb = EEPROM.read(2);// treb eeprom<br />&nbsp; &nbsp;in = EEPROM.read(3);// in eeprom<br />&nbsp; &nbsp;balans = EEPROM.read(4)-4;// balans eeprom<br />&nbsp; &nbsp;lcd.setCursor(4,0);lcd.print(&quot;TDA8425&quot;);delay(1000);<br />&nbsp; &nbsp;MsTimer2::set(3, to_Timer);MsTimer2::start();<br />&nbsp; &nbsp;audio();<br />}</p><p>void loop() {delay(10);<br />&nbsp; &nbsp;if(standby==1){menu=100;lcd.setCursor(0,0);lcd.print(&quot;&nbsp; &nbsp;POWER OFF&nbsp; &nbsp; &quot;);}<br />&nbsp; &nbsp;if(analogRead(A0)&gt;900&amp;&amp;standby==1){standby=0;lcd.clear();lcd.setCursor(0,0);lcd.print(&quot;&nbsp; &nbsp;POWER ON&nbsp; &nbsp; &nbsp;&quot;);digitalWrite(8,HIGH);delay(2000);menu=0;w2=1;}<br />&nbsp; &nbsp;if(analogRead(A0)&gt;900&amp;&amp;standby==0){standby=1;lcd.clear();digitalWrite(8,LOW);delay(500);menu=100;}</p><p>&nbsp; &nbsp;if(analogRead(A1)&gt;900&amp;&amp;mute==0&amp;&amp;standby==0){mute=1;cl();menu=100;lcd.setCursor(0,0);lcd.print(&quot;&nbsp; &nbsp; &nbsp; MUTE&nbsp; &nbsp; &nbsp; &quot;);delay(500);}<br />&nbsp; &nbsp;if(analogRead(A1)&gt;900&amp;&amp;mute==1&amp;&amp;standby==0){mute=0;cl();delay(100);menu=0;w2=1;}</p><p>&nbsp; &nbsp;/*Busque las líneas<br />&nbsp; if(analogRead(A1)&gt;900&amp;&amp;mute==0&amp;&amp;standby==0){mute=1;cl();menu=100;w=0;lcd.setCursor(0,0);lcd.print(&quot; MUTE &quot; );delay(500);}<br />&nbsp; &nbsp;if(analogRead(A1)&gt;900&amp;&amp;mute==1&amp;&amp;standby==0){mute=0;cl();delay(100);menu=0;w2=1;}<br />reemplazar con<br />&nbsp; if ( analogRead(A1)&gt;900&amp;&amp;mute==0&amp;&amp;standby==0{mute=1;audio();delay(500);cl();menu=100;w=0;lcd.setCursor(0,0);lcd. print (&quot; MUTE &quot;);}<br />if(analogRead(A1)&gt;900&amp;&amp;mute==1&amp;&amp;standby==0){mute=0;audio();cl();delay(100);menu=0;w2=1;} */</p><br /><br /><br /><br /><p>&nbsp; &nbsp;<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;if ( irrecv.decode( &amp;ir )) {Serial.print(&quot;0x&quot;);Serial.println( ir.value,HEX);time=millis();w=1;w2=1;irrecv.resume();}// IR приемник<br />&nbsp; &nbsp;if(digitalRead(12)==LOW&amp;&amp;standby==0){menu++;cl();myEnc.write(0);time=millis();w=1;w2=1;if(menu&gt;4){menu=0;}}// меню</p><p>&nbsp; &nbsp; if(ir.value==0xFF02FD&amp;&amp;standby==0){menu++;gr1=0;gr2=0;cl1();time=millis();w=1;w2=1;if(menu&gt;4){menu=0;}}// IR меню кнопка вверх </p><p>&nbsp; &nbsp; if(ir.value==0xFF22DD&amp;&amp;standby==0){menu--;gr1=0;gr2=0;cl1();time=millis();w=1;w2=1;if(menu&lt;0){menu=4;}}// IR меню кнопка вниз <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(ir.value==0xFFA25D&amp;&amp;standby==1){standby=0;gr1=0;gr2=0;cl();lcd.setCursor(0,0);lcd.print(&quot;&nbsp; &nbsp;POWER ON&nbsp; &nbsp; &nbsp;&quot;);digitalWrite(8,HIGH);delay(2000);menu=0;w2=1;}//IR power on<br />&nbsp; &nbsp; if(ir.value==0xFFA25D&amp;&amp;standby==0){standby=1;gr1=0;gr2=0;cl();digitalWrite(8,LOW);delay(500);menu=100;}//IR power off</p><p>&nbsp; &nbsp; if(ir.value==0xFFE21D&amp;&amp;mute==0&amp;&amp;standby==0){mute=1;cl();menu=100;lcd.setCursor(0,0);lcd.print(&quot;&nbsp; &nbsp; &nbsp; MUTE&nbsp; &nbsp; &nbsp; &quot;);delay(500);}// IR MUTE<br />&nbsp; &nbsp; if(ir.value==0xFFE21D&amp;&amp;mute==1&amp;&amp;standby==0){mute=0;cl();menu=0;w2=1;}//IR MUTE</p><p>&nbsp; &nbsp; <br />/////////////////////// VOLUME ///////////////////////////////////<br />&nbsp; if(menu==0){ <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFA857){vol++;gr1=1;gr2=0;cl();w2=1;ogr_vol();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl();w2=1;ogr_vol();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFE01F){vol--;gr1=0;gr2=1;cl();w2=1;ogr_vol();audio();}// кнопка &lt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl();w2=1;ogr_vol();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if (newPosition != oldPosition){oldPosition = newPosition;<br />&nbsp; &nbsp; vol=vol+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;ogr_vol();audio();} <br />&nbsp; &nbsp; <br />&nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot;VOLUME&nbsp; &quot;);<br />&nbsp; &nbsp;lcd.print(&quot; &quot;);lcd.print((-60+vol)*2);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);vol_d=vol-15;<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>//////////////// BASS /////////////////////////////////////<br />&nbsp; if(menu==1){ <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFA857){bass++;gr1=1;gr2=0;cl();w2=1;ogr_bass();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl();w2=1;ogr_bass();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFE01F){bass--;gr1=0;gr2=1;cl();w2=1;ogr_bass();audio();}// кнопка &lt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl();w2=1;ogr_bass();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if (newPosition != oldPosition){oldPosition = newPosition;<br />&nbsp; &nbsp; bass=bass+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;ogr_bass();audio();} </p><p>&nbsp; &nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot;BASS&nbsp; &nbsp; &nbsp; &quot;);<br />&nbsp; switch(bass){<br />&nbsp; &nbsp; case 11: bass_d=15;break;<br />&nbsp; &nbsp; case 10: bass_d=12;break;<br />&nbsp; &nbsp; case 9:&nbsp; bass_d=9;break;<br />&nbsp; &nbsp; case 8:&nbsp; bass_d=6;break;<br />&nbsp; &nbsp; case 7:&nbsp; bass_d=3;break;<br />&nbsp; &nbsp; case 6:&nbsp; bass_d=0;break;<br />&nbsp; &nbsp; case 5:&nbsp; bass_d=-3;break;<br />&nbsp; &nbsp; case 4:&nbsp; bass_d=-6;break;<br />&nbsp; &nbsp; case 3:&nbsp; bass_d=-9;break;<br />&nbsp; &nbsp; case 2:&nbsp; bass_d=-12;break;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp;if(bass_d&gt;=0){lcd.print(&quot;+&quot;);}else{lcd.print(&quot;-&quot;);}<br />&nbsp; &nbsp;if(bass_d&gt;-10&amp;&amp;bass_d&lt;=0||bass_d&lt;10&amp;&amp;bass_d&gt;0){{lcd.print(&quot; &quot;);}}<br />&nbsp; lcd.print(abs(bass_d));lcd.print(&quot; dB&nbsp; &nbsp;&quot;);<br />&nbsp; &nbsp; if(w2==1){bass_d=bass_d+12;<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+3+1,1);lcd.print(&quot;&nbsp; &nbsp;&quot;);}}<br />&nbsp; &nbsp; if(bass_d==0){lcd.setCursor(0,1);lcd.print(&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;);}w2=0;}}</p><p>/////////////////////// TREBLE //////////////////////////////////////////////////////<br />&nbsp; if(menu==2){ <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFA857){treb++;gr1=1;gr2=0;cl();w2=1;ogr_treb();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl();w2=1;ogr_treb();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFE01F){treb--;gr1=0;gr2=1;cl();w2=1;ogr_treb();audio();}// кнопка &lt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl();w2=1;ogr_treb();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if (newPosition != oldPosition){oldPosition = newPosition;<br />&nbsp; &nbsp; treb=treb+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;ogr_treb();audio();} </p><p>&nbsp; &nbsp; &nbsp;lcd.setCursor(0,0);lcd.print(&quot;TREBLE&nbsp; &nbsp; &quot;);<br />&nbsp; switch(treb){<br />&nbsp; &nbsp; case 10: treb_d=12;break;<br />&nbsp; &nbsp; case 9:&nbsp; treb_d=9;break;<br />&nbsp; &nbsp; case 8:&nbsp; treb_d=6;break;<br />&nbsp; &nbsp; case 7:&nbsp; treb_d=3;break;<br />&nbsp; &nbsp; case 6:&nbsp; treb_d=0;break;<br />&nbsp; &nbsp; case 5:&nbsp; treb_d=-3;break;<br />&nbsp; &nbsp; case 4:&nbsp; treb_d=-6;break;<br />&nbsp; &nbsp; case 3:&nbsp; treb_d=-9;break;<br />&nbsp; &nbsp; case 2:&nbsp; treb_d=-12;break;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp;if(treb_d&gt;=0){lcd.print(&quot;+&quot;);}else{lcd.print(&quot;-&quot;);}<br />&nbsp; &nbsp;if(treb_d&gt;-10&amp;&amp;treb_d&lt;=0||treb_d&lt;10&amp;&amp;treb_d&gt;0){{lcd.print(&quot; &quot;);}}<br />&nbsp; lcd.print(abs(treb_d));lcd.print(&quot; dB&nbsp; &nbsp;&quot;);<br />&nbsp; &nbsp; if(w2==1){treb_d=treb_d+12;<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+4,1);lcd.write((uint8_t)0);lcd.setCursor(z0+4+1,1);lcd.print(&quot;&nbsp; &nbsp;&quot;);}}<br />&nbsp; &nbsp; if(treb_d==0){lcd.setCursor(0,1);lcd.print(&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;);}w2=0;}}</p><p>//////////////// BALANCE /////////////////////////////////////<br />&nbsp; &nbsp;if(menu==3){ <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFA857){balans++;gr1=1;gr2=0;cl();w2=1;ogr_balans();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){balans++;gr2=0;cl();w2=1;ogr_balans();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFE01F){balans--;gr1=0;gr2=1;cl();w2=1;ogr_balans();audio();}// кнопка &lt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){balans--;gr1=0;cl();w2=1;ogr_balans();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if (newPosition != oldPosition){oldPosition = newPosition;<br />&nbsp; &nbsp; balans=balans+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;lcd.clear();ogr_balans();audio();} </p><p>&nbsp; &nbsp; lcd.setCursor(0,0);<br />&nbsp; &nbsp;if(balans*2&gt;=0){lcd.print(&quot;-&quot;);}else{lcd.print(&quot;+&quot;);}<br />&nbsp; lcd.print(abs(balans*2));lcd.print(&quot; dB &quot;);<br />&nbsp; lcd.print(&quot; &lt;&gt;&nbsp; &quot;);<br />&nbsp; &nbsp;if(balans*2&gt;=0){lcd.print(&quot;+&quot;);}else{lcd.print(&quot;-&quot;);}<br />&nbsp; lcd.print(abs(balans*2));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>&nbsp; ///////////////////////// input /////////////////////////////<br />&nbsp; if(menu==4){<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFA857){in++;gr1=1;gr2=0;cl1();w2=1;ogr_in();audio();}// кнопка &gt; <br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr1==1){in++;gr2=0;cl1();w2=1;ogr_in();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFE01F){in--;gr1=0;gr2=1;cl1();w2=1;ogr_in();audio();}// кнопка &lt;<br />&nbsp; &nbsp; &nbsp;if(ir.value==0xFFFFFFFF and gr2==1){in--;gr1=0;cl1();w2=1;ogr_in();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;<br />&nbsp; &nbsp; <br />if (newPosition != oldPosition) {<br />&nbsp; &nbsp; oldPosition = newPosition;<br />&nbsp; &nbsp; in=in+newPosition;myEnc.write(0);newPosition=0;audio();lcd.clear();time=millis();w=1;ogr_in();audio();}</p><p>&nbsp; lcd.setCursor(0,0);lcd.print(&quot;Source selector&quot;);<br />&nbsp; lcd.setCursor(0,1);lcd.print(&quot;INPUT: &quot;);lcd.print(in);<br /> }<br />////////////////////////////////////////////////////////////////</p><p>&nbsp; &nbsp; if(millis()-time&gt;10000 &amp;&amp; w==1){// сохранение всех настроек в eeprom через 10 сек неактивности<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);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(2,treb);<br />&nbsp; &nbsp; &nbsp;EEPROM.update(3,in);<br />&nbsp; &nbsp; &nbsp;w=0;w2=1;menu=0;cl(); }</p><br /><p>}//loop<br />void ogr_in(){if(in&gt;1){in=0;}if(in&lt;0){in=1;}}<br />void ogr_balans(){if(balans&gt;4){balans=4;}if(balans&lt;-4){balans=-4;}}<br />void ogr_treb(){if(treb&gt;10){treb=10;}if(treb&lt;2){treb=2;}}<br />void ogr_bass(){if(bass&gt;11){bass=11;}if(bass&lt;2){bass=2;}}<br />void ogr_vol(){if(vol&lt;0){vol=0;}if(vol&gt;63){vol=63;}}<br />void cl(){ir.value=0;delay(200);lcd.clear();}<br />void cl1(){ir.value=0;delay(400);lcd.clear();}<br />void to_Timer(){newPosition = myEnc.read()/4;}<br />void audio(){<br />&nbsp; tda.setVolumeL(vol+balans);<br />&nbsp; tda.setVolumeR(vol-balans);<br />&nbsp; tda.setBass(bass);<br />&nbsp; tda.setTreble(treb);<br />&nbsp; tda.setMute(mute);<br />&nbsp; tda.setSource(in);</p><br /><p>/*Cambie las líneas:<br />tda.setVolumeL(vol+balans);<br />tda.setVolumeR(vol-balans);<br />en<br />tda.setVolumeL(vol+16+balans);<br />tda.setVolumeR(vol+16-balans);*/<br />&nbsp; <br /> }</p>]]></content>
			<author>
				<name><![CDATA[msanfelipe133]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1804</uri>
			</author>
			<updated>2024-09-04T14:10:42Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10728#p10728</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10088#p10088" />
			<content type="html"><![CDATA[<p>спасибо</p>]]></content>
			<author>
				<name><![CDATA[chika85]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1114</uri>
			</author>
			<updated>2024-04-12T16:16:29Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10088#p10088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10087#p10087" />
			<content type="html"><![CDATA[<p>ADMUX&nbsp; = 0b11100001; // a1</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-04-12T13:01:08Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10087#p10087</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=10086#p10086" />
			<content type="html"><![CDATA[<p>а где в прошивке указан пин а0 для анализатора может ардуинка кривая попалась хочу попробовать поменять пин</p>]]></content>
			<author>
				<name><![CDATA[chika85]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1114</uri>
			</author>
			<updated>2024-04-12T12:57:47Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=10086#p10086</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9637#p9637" />
			<content type="html"><![CDATA[<p>понял спасибо я кнопки не припаивал думал без них</p>]]></content>
			<author>
				<name><![CDATA[chika85]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1114</uri>
			</author>
			<updated>2024-03-04T17:47:25Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9637#p9637</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9636#p9636" />
			<content type="html"><![CDATA[<p>Дополнительно во второе меню (нажать и удерживать кнопку энкодера) добавлены настройки анализатора спектра:</p><p>AUTO_GAIN — автонастройка по громкости (0…1)<br />VOL_THR — порог тишины, ниже него отображения на экране не будет, это значение всегда должно быть быть меньше DEF_GAIN (10…100) (25-30 оптимально), параметр активен когда AUTO_GAIN = 1<br />LOW_PASS — нижний порог чувствительности шумов, нет скачков при отсутствии звука, это значение должно быть меньше DEF_GAIN (10..100) (35-40 оптимально)<br />DEF_GAIN — максимальный порог по умолчанию, это значение всегда должно быть выше VOL_THR и LOW_PASS (30…200)(80-120 оптимально), параметр активен когда AUTO_GAIN = 0<br />GRAPH_ATT — аттенюатор чувствительности (0,5…1,5), параметр активен когда AUTO_GAIN = 1<br />GRAPHICS — изменение вида графических полос (0…4)<br />Conv. speed — скорость преобразования для аналогового входа (чем больше значение тем более узкий частотный диапазон):<br />0 — CLK/4<br />1 — CLK/8 (оптимально)<br />2&nbsp; — CLK/16<br />3&nbsp; — CLK/32<br />4&nbsp; — CLK/64<br />5&nbsp; — CLK/128<br />Для перехода по параметрам настроек анализатора спектра необходимо нажимать кнопку MUTE.</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-03-04T17:37:58Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9636#p9636</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9635#p9635" />
			<content type="html"><![CDATA[<p>от куда? дс дс преобразователь с али может давать шумы по питанию? кондер стоит на а0 и на входной сигнал</p>]]></content>
			<author>
				<name><![CDATA[chika85]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1114</uri>
			</author>
			<updated>2024-03-04T17:35:53Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9635#p9635</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9634#p9634" />
			<content type="html"><![CDATA[<p>шумы ловит<br />В анализаторе есть система усиления сигнала, для выравнивания спектра для разной громкости. При КЗ входа, анализатор должен показывать по нулям все полосы.</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-03-04T17:33:02Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9634#p9634</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9633#p9633" />
			<content type="html"><![CDATA[<p>это даже&nbsp; бе входящего сигнала</p>]]></content>
			<author>
				<name><![CDATA[chika85]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1114</uri>
			</author>
			<updated>2024-03-04T17:30:37Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9633#p9633</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9632#p9632" />
			<content type="html"><![CDATA[<p>высокие тоже на всякий заменил но вч не добавляется ну и хр... на эти вч <br />тут еще анализатор криво показывает<span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/03/7f933513bbd1e54576d495c87b72fa2a.jpeg" alt="http://forum.rcl-radio.ru/uploads/images/2024/03/7f933513bbd1e54576d495c87b72fa2a.jpeg" /></span></p>]]></content>
			<author>
				<name><![CDATA[chika85]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1114</uri>
			</author>
			<updated>2024-03-04T17:29:37Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9632#p9632</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: TDA8425 + энкодер + пульт + STANDBY]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=9631#p9631" />
			<content type="html"><![CDATA[<p>0,022-0,1 мкФ</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-03-04T16:40:43Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=9631#p9631</id>
		</entry>
</feed>
