<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[forum.rcl-radio.ru &mdash; RGB лента]]></title>
		<link>http://forum.rcl-radio.ru/viewtopic.php?id=170</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=170&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «RGB лента».]]></description>
		<lastBuildDate>Thu, 07 Nov 2024 19:56:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10974#p10974</link>
			<description><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/11/210249f37dd386a6dfec77869fbda3f3.jpg" alt="http://forum.rcl-radio.ru/uploads/images/2024/11/210249f37dd386a6dfec77869fbda3f3.jpg" /></span> <br />Приветствую. Делаю подсветку рабочего стола на адресной ленте WS2812B.&nbsp; Нашел в этой теме подходящий код:<br />4 кнопки управления:<br />1 и 2 яркость +\-<br />3 - выбор режима<br />4 - программное вкл.выкл<br />Нужно добавить:&nbsp; <br /> управление с пульта IR;<br /> добавление количества цветов в меню SET<br /> при нажатии кнопок R&nbsp; G&nbsp; B&nbsp; - светиться цвета&nbsp; Красный Зелёный Синий<br />#define IR_1 0xF700FF&nbsp; &nbsp;// яркость +<br />#define IR_2 0xF7807F&nbsp; &nbsp;// яркость -<br />#define IR_3 0xF740BF&nbsp; &nbsp;// выкл<br />#define IR_4 0xF7C03F&nbsp; &nbsp;// вкл<br />#define IR_5 0xF720DF&nbsp; &nbsp;// красный<br />#define IR_6 0xF7A05F&nbsp; &nbsp;// зелёный<br />#define IR_7 0xF7609F&nbsp; &nbsp;// синий<br />#define IR_8 0xF7E01F&nbsp; &nbsp;// белый 5000К<br />#define IR_9 0xF710EF&nbsp; &nbsp;// белый теплый 2700К<br />#define IR_10 0xF7906F&nbsp; // <br />#define IR_11 0xF750AF&nbsp; // <br />#define IR_12 0xF7D02F&nbsp; // переключение режимов SET<br />#define IR_13 0xF730CF&nbsp; // белый теплый 3000К<br />#define IR_14 0xF7B04F&nbsp; //<br />#define IR_15 0xF7708F&nbsp; //<br />#define IR_16 0xF7F00F&nbsp; //<br />#define IR_17 0xF708F7&nbsp; //&nbsp; белый теплый 4000К</p><p>#define LED_PIN&nbsp; &nbsp; 8&nbsp; &nbsp;// вывод управления<br />#define LED_COUNT 185&nbsp; // кол-во светодиодов<br />#define BRIG_MAX 120&nbsp; &nbsp;//максимальная яркость</p><p>Помогите пожалуйста дописать код. Сам я электрик/электронщик.</p>]]></description>
			<author><![CDATA[null@example.com (andrys)]]></author>
			<pubDate>Thu, 07 Nov 2024 19:56:14 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10974#p10974</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=4796#p4796</link>
			<description><![CDATA[<p>Если Вы используете MsTimer2, то удалите: OCR1A = 5000; TCCR1B |= (1 &lt;&lt; WGM12) | (1 &lt;&lt; CS10); TIMSK1 |= (1 &lt;&lt; OCIE1A);</p><p>Тестовый скетч светодиодного кольца работает нормально?</p><div class="codebox"><pre><code>#include &lt;Adafruit_NeoPixel.h&gt; // https://github.com/adafruit/Adafruit_NeoPixel.git
#include &lt;Encoder.h&gt;  // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
  Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, 6, NEO_GRB + NEO_KHZ800);// 8 LED, D6
  Encoder myEnc(9, 8);//CLK, DT
  unsigned long oldPosition  = -999,newPosition;
  int poz,data=30;
  #define KOL 79
  
void setup(){  
  OCR1A = 5000; TCCR1B |= (1 &lt;&lt; WGM12)|(1 &lt;&lt; CS10); TIMSK1 |= (1 &lt;&lt; OCIE1A);
  strip.begin();Serial.begin(9600);
  pinMode(7,INPUT);
  strip.setBrightness(32);
  poz = data/8;
}

void loop(){ 
   if(digitalRead(7)==LOW){
    for(int i=0;i&lt;8;i++){strip.setPixelColor(i, strip.Color(0, 50, 0));}strip.show();delay(300);
    for(int i=0;i&lt;8;i++){strip.setPixelColor(i, strip.Color(0, 0, 0));}strip.show();}
    
   if (newPosition != oldPosition) {oldPosition = newPosition;
    data=data+newPosition;if(data&gt;=0&amp;&amp;data&lt;=KOL){poz=poz+newPosition;}myEnc.write(0);newPosition=0;
    Serial.println(data);}
   
    strip.setPixelColor(poz-1, strip.Color(0, 0, 0));
    strip.setPixelColor(poz, strip.Color(data, 0+data/10, KOL-data));
    strip.setPixelColor(poz+1, strip.Color(0, 0, 0)); 
    
  if(poz&gt;7){poz=0;}if(poz&lt;0){poz=poz+8;}
  if(data&lt;0){data=0;}if(data&gt;KOL){data=KOL;}
    strip.show();
}// LOOP
ISR (TIMER1_COMPA_vect){newPosition = myEnc.read()/4;}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 20 Oct 2021 15:38:52 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=4796#p4796</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=4794#p4794</link>
			<description><![CDATA[<p>Или не используйте библиотеку MsTimer2</p><p>Используйте таймер 2, таймер 1 занять IR:</p><p>OCR2A = 5000; TCCR2B |= (1 &lt;&lt; WGM22) | (1 &lt;&lt; CS20); TIMSK2 |= (1 &lt;&lt; OCIE2A);</p><p>ISR(TIMER2_COMPA_vect){newPosition = myEnc.read()/4;}</p><div class="codebox"><pre><code>#define IR_1 0x807F6897 // Кнопка вверх
#define IR_2 0x807F58A7 // Кнопка вниз
#define IR_3 0x807F0AF5 // Кнопка &gt;
#define IR_4 0x807F8A75 // Кнопка &lt;
#define IR_5 0x807F9867 // Кнопка IN
#define IR_6 0x807FC837 // Кнопка SET
#define IR_7 0x807F827D // Кнопка MUTE
#define IR_8 0x807F02FD // Кнопка STANDBY (POWER)
#define IR_9 0x807F8877 // Кнопка сон 10 минут
#define IR_10 0x807F728D // Кнопка вход 1
#define IR_11 0x807FB04F // Кнопка вход 2
#define IR_12 0x807F30CF // Кнопка вход 3
#define IR_13 0x807F52AD // Кнопка вход 4
#define BRIG 200        // Яркость подсветки экрана в режиме POWER OFF (0...255)
#define KOL 56 // максимальное значение регулировки подсветки
#define KOL1 14 // максимальное значение регулировки подсветки
#include &lt;Adafruit_NeoPixel.h&gt; // https://github.com/adafruit/Adafruit_NeoPixel.git
#include &lt;Wire.h&gt;
#include &lt;PT2314.h&gt;            // http://forum.rcl-radio.ru/misc.php?action=pan_download&amp;item=434&amp;download=1
#include &lt;Wire.h&gt;
#include &lt;LiquidCrystal_I2C.h&gt; // http://forum.rcl-radio.ru/misc.php?action=pan_download&amp;item=45&amp;download=1
#include &lt;Encoder.h&gt;           // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip       
#include &lt;EEPROM.h&gt;
#include &lt;boarddefs.h&gt;
#include &lt;IRremote.h&gt;          // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include &lt;DS3231.h&gt;            // https://github.com/jarzebski/Arduino-DS3231/archive/master.zip
DS3231 clock;
RTCDateTime DateTime;
unsigned long times_son;
unsigned long times, oldPosition  = -56, newPosition;
bool son_k, son;
PT2314 pt;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, 11, NEO_GRB + NEO_KHZ800);     //подсветка 12 LED, D11
LiquidCrystal_I2C lcd(0x27, 16, 2); // Устанавливаем дисплей
IRrecv irrecv(12); // указываем вывод модуля IR приемника
Encoder myEnc(8, 9);// DT, CLK

decode_results ir;
byte v1[8] = {0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111};
byte v2[8] = {0b00111, 0b00111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
byte v3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v4[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v5[8] = {0b11100, 0b11100, 0b00000, 0b00000, 0b00000, 0b00000, 0b11100, 0b11100};
byte v6[8] = {0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100};
byte v7[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00111, 0b00111};
byte v8[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
byte a[6], d1, d2, d3, d4, d5, d6, e1, e2, e3, w, w2, i, www, power, save, gr1, gr2;
int menu, menu0, menu1 = 1, menu2 = 0, vol, bass, treb, att_l, att_r, in, loud_on, gain0, gain1, gain2, gain3, gain4, mute, mute1, mute2, brig, hour, minut, secon;
int poz, data;


void setup() {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  clock.begin();
  strip.begin();
  
  OCR2A = 5000; TCCR2B |= (1 &lt;&lt; WGM22) | (1 &lt;&lt; CS20); TIMSK2 |= (1 &lt;&lt; OCIE2A);
  
  strip.setBrightness(35);
  poz = data / 12;
  irrecv.enableIRIn();

  pinMode(10, INPUT); // МЕНЮ КНОПКА SW энкодера
  pinMode(2, INPUT);  // КНОПКА SET
  pinMode(3, INPUT);  // КНОПКА IN
  pinMode(4, INPUT);  // КНОПКА MUTE
  pinMode(5, INPUT);  // КНОПКА STANDBY
  pinMode(7, OUTPUT); // ВЫХОД УПРАВЛЕНИЯ STANDBY
  pinMode(6, OUTPUT); // ВЫХОД УПРАВЛЕНИЯ ПОДСВЕТКОЙ
  analogWrite(6, 255);
  lcd.setCursor(0, 0);
  lcd.print(&quot;AmplifieR ClassA&quot;);
  lcd.setCursor(0, 1);
  lcd.print(&quot;    JLH 1969&quot;);
  delay(2000); lcd.clear(); // Меняем заставку


  //  clock.setDateTime(__DATE__, __TIME__); // Устанавливаем время на часах, основываясь на времени компиляции скетча

  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);

  if (EEPROM.read(100) != 0) {
    for (int i = 0; i &lt; 101; i++) {
      EEPROM.update(i, 0); // очистка памяти при первом включении
    }
  }
  vol = EEPROM.read(0);
  treb = EEPROM.read(1) - 7;
  bass = EEPROM.read(2) - 7;
  in = EEPROM.read(3);
  att_l = EEPROM.read(4);
  att_r = EEPROM.read(5);
  gain1 = EEPROM.read(6);
  gain2 = EEPROM.read(7);
  gain3 = EEPROM.read(8);
  gain4 = EEPROM.read(9);
  loud_on = EEPROM.read(10);
  brig = EEPROM.read(11);
  audio();
  analogWrite(6, brig);
}

void loop() {
  if (digitalRead(10) == LOW) {
    for (int i = 0; i &lt; 12; i++) {
      strip.setPixelColor(i, strip.Color(50, 0, 0));
    } strip.show(); delay(100);
    for (int i = 0; i &lt; 12; i++) {
      strip.setPixelColor(i, strip.Color(0, 0, 0));
    } strip.show();
  }
  DateTime = clock.getDateTime();
  hour = DateTime.hour;
  minut = DateTime.minute;
  secon = DateTime.second;

  ////////////////////// IR ///////////////////////////////////////////////////////////////

  if ( irrecv.decode( &amp;ir )) {
    Serial.print(&quot;0x&quot;);  // IR приемник - чтение, в мониторе порта отображаются коды кнопок
    Serial.println( ir.value, HEX);
    irrecv.resume();
    times = millis();
    w = 1;
  }
  if (ir.value == 0) {
    gr1 = 0;  // запрет нажатий не активных кнопок пульта
    gr2 = 0;
  }

  if (mute == 0 &amp;&amp; power == 0) {
    if (ir.value == IR_6 &amp;&amp; menu1 == 1) {
      menu1 = 0;
      menu2 = 1;
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;SYSTEM&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }
    if (ir.value == IR_6 &amp;&amp; menu2 == 1) {
      menu1 = 1;
      menu2 = 0;
      menu = 0;
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;AUDIO&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }

    if (ir.value == IR_1 &amp;&amp; menu1 == 1) {
      menu++;  //меню 1
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu &gt; 2) {
        menu = 0;
      }
    }
    if (ir.value == IR_2 &amp;&amp; menu1 == 1) {
      menu--;  //меню 1
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu &lt; 0) {
        menu = 2;
      }
    }

    if (ir.value == IR_1 &amp;&amp; menu2 == 1) {
      menu0++;  //меню 2
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu0 &gt; 4) {
        menu0 = 0;
      }
    }
    if (ir.value == IR_2 &amp;&amp; menu2 == 1) {
      menu0--;  //меню 2
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu0 &lt; 0) {
        menu0 = 4;
      }
    }

    if (ir.value == IR_5) {
      in++;  // IN
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (in &gt; 3) {
        in = 0;
      } lcd.setCursor(3, 0);
      switch (in) {
        case 0: lcd.print(&quot;  AUX  1&quot;); break;
        case 1: lcd.print(&quot;  AUX  2&quot;); break;
        case 2: lcd.print(&quot;  AUX  3&quot;); break;
        case 3: lcd.print(&quot;Bluetooth&quot;); break;
      }
      audio();
      delay(1000);
      lcd.clear();
    }
  }

  if (ir.value == IR_7 &amp;&amp; mute == 0 &amp;&amp; power == 0) {
    mute = 1;  // MUTE
    pt.setAttR(31);
    pt.setAttL(31);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.setCursor(6, 0);
    lcd.print(&quot;MUTE&quot;);
    menu1 = 100;
    menu2 = 100;
    delay(500);
  }
  if (ir.value == IR_7 &amp;&amp; mute == 1 &amp;&amp; power == 0) {
    mute = 0;  // MUTE
    cl();
    menu1 = 1;
    menu = 0;
    gr1 = 0;
    gr2 = 0;
    cl();
    audio();
  }

  if (ir.value == IR_8 &amp;&amp; power == 0) {
    power = 1;  // power off
    pt.setAttR(31);
    pt.setAttL(31);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    menu0 = 0;
    menu1 = 0;
    menu2 = 0;
    save = 1;
    analogWrite(6, BRIG);
    delay(1000);
    lcd.clear();
  }
  if (ir.value == IR_8 &amp;&amp; power == 1) {
    digitalWrite(7, HIGH);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER   ON &quot;);
    menu1 = 1;
    menu = 0;
    loud_on = 1;
    myEnc.write(0);
    audio();
    analogWrite(6, brig);
    delay(1000);
    power = 0;  // power on
    lcd.clear();
  }

  if (ir.value == IR_9) {
    cl(); son_k = 1;
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    lcd.setCursor(5, 1);
    lcd.print(&quot;10 MIN&quot;);
    delay(1000);
    lcd.clear();
  }
  if (son_k == 0) {
    times_son = millis();
  }
  if (millis() - times_son &gt; 600000) {                //Время таймера в милисек
    son = 1;
  }

  if ((ir.value == IR_8 &amp;&amp; power == 0) || son == 1) {
    power = 1;  // power off
    son = 0;  // power on
    son_k = 0;
    times_son = millis();
    pt.setAttR(31);
    pt.setAttL(31);
    audio();
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    menu0 = 0;
    menu1 = 0;
    menu2 = 0;
    save = 1;
    analogWrite(6, BRIG);
    delay(1000);
    lcd.clear();
  }
  if (ir.value == IR_8 &amp;&amp; power == 1) {
    power = 0;
    digitalWrite(7, HIGH);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER   ON &quot;);
    menu1 = 1;
    menu = 0;
    myEnc.write(0);
    audio();
    analogWrite(6, brig);
    delay(1000);
    lcd.clear();
  }
  if (ir.value == IR_10) {
    in = 0;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;  AUX  1&quot;);
    delay(1500);
  }
  if (ir.value == IR_11) {
    in = 1;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;  AUX  2&quot;);
    delay(1500);
  }
  if (ir.value == IR_12) {
    in = 2;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;  AUX  3&quot;);
    delay(1500);
  }
  if (ir.value == IR_13) {
    in = 3;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;Bluetooth&quot;);
    delay(1500);
    lcd.clear();
  }

  /////////////////////////////// УПРАВЛЕНИЕ //////////////////////////////////////////////

  if (mute == 0 &amp;&amp; power == 0) {
    if (digitalRead(2) == HIGH &amp;&amp; menu1 == 1) {
      menu1 = 0;
      menu2 = 1;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;SYSTEM&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }
    if (digitalRead(2) == HIGH &amp;&amp; menu2 == 1) {
      menu1 = 1;
      menu2 = 0;
      menu = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;AUDIO&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }

    if (digitalRead(10) == LOW &amp;&amp; menu1 == 1) {
      menu++;  //меню 1
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu &gt; 2) {
        menu = 0;
      }
    }
    if (digitalRead(10) == LOW &amp;&amp; menu2 == 1) {
      menu0++;  //меню 2
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu0 &gt; 4) {
        menu0 = 0;
      }
    }

    if (digitalRead(3) == HIGH) {
      in++;  // IN
      cl();;
      times = millis();
      w = 1;
      w2 = 1;
      if (in &gt; 3) {
        in = 0;
      } lcd.setCursor(3, 0);
      switch (in) {
        case 0: lcd.print(&quot;  AUX  1&quot;); break;
        case 1: lcd.print(&quot;  AUX  2&quot;); break;
        case 2: lcd.print(&quot;  AUX  3 &quot;); break;
        case 3: lcd.print(&quot;Bluetooth&quot;); break;
      }
      audio();
      delay(1000);
      lcd.clear();
    }
  }

  if (digitalRead(4) == HIGH &amp;&amp; mute == 0 &amp;&amp; power == 0) {
    mute = 1;  // MUTE
    pt.setAttR(31);
    pt.setAttL(31);
    cl();
    lcd.setCursor(6, 0);
    lcd.print(&quot;MUTE&quot;);
    menu1 = 100;
    menu2 = 100;
    delay(500);
  }
  if (digitalRead(4) == HIGH &amp;&amp; mute == 1 &amp;&amp; power == 0) {
    mute = 0;  // MUTE
    cl();
    menu1 = 1;
    menu = 0;
    cl();
    audio();
  }

  if (digitalRead(5) == HIGH &amp;&amp; power == 0) {
    power = 1;  // power off
    pt.setAttR(31);
    pt.setAttL(31);
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    menu0 = 0;
    menu1 = 0;
    menu2 = 0;
    save = 1;
    analogWrite(6, BRIG);
    delay(1000);
    lcd.clear();
  }
  if (power == 0) {
    digitalWrite(7, HIGH);
  }
  if (digitalRead(5) == HIGH &amp;&amp; power == 1) {
    power = 0;  // power on
    digitalWrite(7, HIGH);
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER   ON &quot;);
    menu1 = 1;
    menu = 0;
    delay(1000);
    myEnc.write(0);
    audio();
    analogWrite(6, brig);
    lcd.clear();
  }

  //if(power==0){digitalWrite(7,LOW);}// инверсия выхода STANDBY

  if (save == 1 &amp;&amp; w2 == 1) {
    save = 0; w2 = 0;
    EEPROM.update(0, vol);
    EEPROM.update(1, treb + 7);
    EEPROM.update(2, bass + 7);
    EEPROM.update(3, in);
    EEPROM.update(4, att_l);
    EEPROM.update(5, att_r);
    EEPROM.update(6, gain1);
    EEPROM.update(7, gain2);
    EEPROM.update(8, gain3);
    EEPROM.update(9, gain4);
    EEPROM.update(10, loud_on);
    EEPROM.update(11, brig);
  }

  ////////////// VOLUME ///////////////////////////////////////////////////////////////////

  if (menu == 0 &amp;&amp; menu1 == 1) {
    if (ir.value == IR_3) {
      vol++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      vol++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    if (ir.value == IR_4) {
      vol--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      vol--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      vol = vol + newPosition;
      oldPosition = newPosition;
      data = data + newPosition; if (data &gt;= 0 &amp;&amp; data &lt;= KOL) {
        poz = poz + newPosition;
        times = millis();
      }
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      strip.setPixelColor(poz - 1, strip.Color(0, 0, 0));
      strip.setPixelColor(poz, strip.Color(data, 0 + data / 10, KOL - data));
      strip.setPixelColor(poz + 1, strip.Color(0, 0, 0));

      if (poz &gt; 11) {
        poz = 0;
      } if (poz &lt; 0) {
        poz = poz + 12;
      }
      if (data &lt; 0) {
        data = 0;
      } if (data &gt; KOL) {
        data = KOL;
      }
      strip.show();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    a[0] = vol / 10; a[1] = vol % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;IN&quot;); lcd.print(in + 1); lcd.print(&quot;  VOL&quot;);
    if (vol &lt; 0) {
      lcd.setCursor(9, 1);
      lcd.write((uint8_t)8);
    } else {
      lcd.setCursor(9, 1);
      lcd.print(&quot; &quot;);
    }
    times_f();
  }

  ////////////// BASS ///////////////////////////////////////////////////////////////////

  if (menu == 1 &amp;&amp; menu1 == 1) {
    if (ir.value == IR_3) {
      bass++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      bass++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    if (ir.value == IR_4) {
      bass--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      bass--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      bass = bass + newPosition;
      oldPosition = newPosition;
      data = data + newPosition; if (data &gt;= 0 &amp;&amp; data &lt;= KOL1) {
        poz = poz + newPosition;
      }      
      myEnc.write(0);
      newPosition = 0;
      
      strip.setPixelColor(poz - 1, strip.Color(0, 0, 0));
      strip.setPixelColor(poz, strip.Color(data, 0 + data / 10, KOL1 - data));
      strip.setPixelColor(poz + 1, strip.Color(0, 0, 0));

      if (poz &gt; 11) {
        poz = 0;
      } if (poz &lt; 0) {
        poz = poz + 12;
      }
      if (data &lt; 0) {
        data = 0;
      } if (data &gt; KOL1) {
        data = KOL1;
      }
      strip.show();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    a[0] = abs(bass * 2) / 10; a[1] = abs(bass * 2) % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;BASS   dB&quot;);
    if (bass &lt; 0) {
      lcd.setCursor(9, 1);
      lcd.write((uint8_t)8);
    } else {
      lcd.setCursor(9, 1);
      lcd.print(&quot; &quot;);
    }
    times_f();
  }

  ////////////// TREBLE ///////////////////////////////////////////////////////////////////

  if (menu == 2 &amp;&amp; menu1 == 1) {
    if (ir.value == IR_3) {
      treb++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      treb++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    if (ir.value == IR_4) {
      treb--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      treb--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      treb = treb + newPosition;
      oldPosition = newPosition;
      data = data + newPosition; if (data &gt;= 0 &amp;&amp; data &lt;= KOL1) {
        poz = poz + newPosition;
      }      
      myEnc.write(0);
      newPosition = 0;
      
      strip.setPixelColor(poz - 1, strip.Color(0, 0, 0));
      strip.setPixelColor(poz, strip.Color(data, 0 + data / 10, KOL1 - data));
      strip.setPixelColor(poz + 1, strip.Color(0, 0, 0));

      if (poz &gt; 11) {
        poz = 0;
      } if (poz &lt; 0) {
        poz = poz + 12;
      }
      if (data &lt; 0) {
        data = 0;
      } if (data &gt; KOL1) {
        data = KOL1;
      }
      strip.show();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    a[0] = abs(treb * 2) / 10; a[1] = abs(treb * 2) % 10;

    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;TREBLE dB&quot;);
    if (treb &lt; 0) {
      lcd.setCursor(9, 1);
      lcd.write((uint8_t)8);
    } else {
      lcd.setCursor(9, 1);
      lcd.print(&quot; &quot;);
    }
    times_f();
  }

  ////////////// ATT_L ///////////////////////////////////////////////////////////////////

  if (menu0 == 0 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      att_l++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      att_l++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    if (ir.value == IR_4) {
      att_l--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      att_l--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      att_l = att_l + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    a[0] = abs(att_l) / 10; a[1] = abs(att_l) % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;ATT_L&quot;);
    lcd.setCursor(0, 1); lcd.print(-att_l * 1.25, 2);
    lcd.print(&quot; &quot;); lcd.setCursor(6, 1); lcd.print(&quot;dB&quot;);
  }

  ////////////// ATT_R ///////////////////////////////////////////////////////////////////

  if (menu0 == 1 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      att_r++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      att_r++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    if (ir.value == IR_4) {
      att_r--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      att_r--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      att_r = att_r + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    a[0] = abs(att_r) / 10; a[1] = abs(att_r) % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;ATT_R&quot;);
    lcd.setCursor(0, 1); lcd.print(-att_r * 1.25, 2);
    lcd.print(&quot; &quot;); lcd.setCursor(6, 1); lcd.print(&quot;dB&quot;);
  }

  ////////////// INPUT GAIN ///////////////////////////////////////////////////////////////////

  if (menu0 == 2 &amp;&amp; menu2 == 1) {
    switch (in) {
      case 0: gain0 = gain1; break;
      case 1: gain0 = gain2; break;
      case 2: gain0 = gain3; break;
      case 3: gain0 = gain4; break;
    }

    if (ir.value == IR_3) {
      gain0++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      gain0++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }
    if (ir.value == IR_4) {
      gain0--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      gain0--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      gain0 = gain0 + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      www = 1;
      w = 1;
      w2 = 1;
      gain_func();
    }

    switch (in) {
      case 0: gain1 = gain0; break;
      case 1: gain2 = gain0; break;
      case 2: gain3 = gain0; break;
      case 3: gain4 = gain0; break;
    }
    a[0] = abs(gain0);

    for (i = 0; i &lt; 1; i++) {
      switch (i) {
        case 0: e1 = 13, e2 = 14, e3 = 15;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }
    lcd.setCursor(0, 1); lcd.print(&quot;GAIN &quot;); lcd.print(gain0 * 3.75, 2); lcd.print(&quot; &quot;); lcd.setCursor(10, 1); lcd.print(&quot;dB&quot;);
    if (www == 1) {
      audio();
      www = 0;
    }
    lcd.setCursor(0, 0); lcd.print(&quot;INPUT &quot;); lcd.print(in + 1);
  }

  ////////////// LOUDNESS ///////////////////////////////////////////////////////////////////

  if (menu0 == 3 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      loud_on++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      loud_on++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }
    if (ir.value == IR_4) {
      loud_on--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      loud_on--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      loud_on = loud_on + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      };
      audio();
    }
    if (loud_on == 1) {
      lcd.setCursor(2, 0);
      lcd.print(&quot;LOUDNESS  ON &quot;);
      delay(200);
    } else {
      lcd.setCursor(2, 0);
      lcd.print(&quot;LOUDNESS  OFF&quot;);
      delay(200);
    }
  }

  ////////////// BRIGHTNESS ///////////////////////////////////////////////////////////////////

  if (menu0 == 4 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      brig++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      brig++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    if (ir.value == IR_4) {
      brig--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      brig--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      brig = brig + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    a[0] = abs(brig) / 100; a[1] = abs(brig) / 10 % 10; a[2] = abs(brig) % 10;
    for (i = 0; i &lt; 3; i++) {
      switch (i) {
        case 0: e1 = 7, e2 = 8, e3 = 9; break;
        case 1: e1 = 10, e2 = 11, e3 = 12; break;
        case 2: e1 = 13, e2 = 14, e3 = 15; break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;BRIGHT&quot;);
    lcd.setCursor(0, 1); lcd.print(brig * 100 / 255); lcd.print(&quot; &quot;); lcd.setCursor(4, 1); lcd.print(&quot;%&quot;);
  }
  ////////////////////////////////////////////////////////////////////////////////////////////

  if (millis() - times &gt; 10000 &amp;&amp; w == 1 &amp;&amp; mute == 0 &amp;&amp; power == 0) {
    w = 0;
    menu2 = 0;
    menu1 = 1;
    menu = 0;
    cl();
  }

  /////////////////// ЧАСЫ ///////////////////////////////////////////////////////////////////

  if (power == 1) {
    digitalWrite(7, LOW);
    a[0] = DateTime.hour / 10;
    a[1] = DateTime.hour % 10;
    a[2] = DateTime.minute / 10;
    a[3] = DateTime.minute % 10;
    a[4] = DateTime.second / 10;
    a[5] = DateTime.second % 10;
    for (i = 0; i &lt; 4; i++) {
      switch (i) {
        case 0: e1 = 0, e2 = 1, e3 = 2; break;
        case 1: e1 = 3, e2 = 4, e3 = 5; break;
        case 2: e1 = 7, e2 = 8, e3 = 9; break;
        case 3: e1 = 10, e2 = 11, e3 = 12; break;
      } digit();
    }

    lcd.setCursor(6, 0); lcd.print(&quot;.&quot;); lcd.setCursor(6, 1); lcd.print(&quot;.&quot;);
    lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
    //// set time ////
    if (digitalRead(10) == LOW &amp;&amp; digitalRead(2) == HIGH) {
      hour++;
      if (hour &gt; 23) {
        hour = 0;
      } clock.setDateTime(2020, 9, 15, hour, minut, secon);
      delay(100);
    }
    if (digitalRead(10) == LOW &amp;&amp; digitalRead(3) == HIGH) {
      minut++;
      if (minut &gt; 59) {
        minut = 0;
      } clock.setDateTime(2020, 9, 15, hour, minut, secon);
      delay(100);
    }
    if (digitalRead(10) == LOW &amp;&amp; digitalRead(4) == HIGH) {
      secon = 0;
      clock.setDateTime(2020, 9, 15, hour, minut, secon);
      delay(100);
    }
  }

}/////////////// loop end

void times_f() {
  lcd.setCursor(0, 1);
  lcd.print(DateTime.hour / 10);
  lcd.print(DateTime.hour % 10);
  lcd.print(&quot;:&quot;);
  lcd.print(DateTime.minute / 10);
  lcd.print(DateTime.minute % 10);
  lcd.print(&quot;:&quot;);
  lcd.print(DateTime.second / 10);
  lcd.print(DateTime.second % 10);
}
void brig_func() {
  if (brig &lt; 0) {
    brig = 0;
  } if (brig &gt; 255) {
    brig = 255;
  }
}
void gain_func() {
  if (gain0 &lt; 0) {
    gain0 = 0;
  } if (gain0 &gt; 3) {
    gain0 = 3;
  }
}
void att_r_func() {
  if (att_r &lt; 0) {
    att_r = 0;
  } if (att_r &gt; 24) {
    att_r = 24;
  }
}
void att_l_func() {
  if (att_l &lt; 0) {
    att_l = 0;
  } if (att_l &gt; 24) {
    att_l = 24;
  }
}
void treb_func() {
  if (treb &lt; -7) {
    treb = -7;
  } if (treb &gt; 7) {
    treb = 7;
  }
}
void bass_func() {
  if (bass &lt; -7) {
    bass = -7;
  } if (bass &gt; 7) {
    bass = 7;
  }
}
void vol_func() {
  if (vol &lt; 0) {
    vol = 0;
  } if (vol &gt; 56) {
    vol = 56;
  }
}
void cl() {
  ir.value = 0;
  delay(300);
  lcd.clear();
}
void cl1() {
  ir.value = 0;
  delay(200);
}
void audio() {
  pt.setVolume(vol); // int 0...56 === -70...0 dB step 1.25 dB
  pt.setAttL(att_l); // int 0...24 === 0...-30 db step 1.25 dB &gt; int 31 === mute on
  pt.setAttR(att_r); // int 0...24 === 0...-30 dB step 1.25 dB &gt; int 31 === mute on
  pt.setSwitch(in, loud_on , gain0);
  // input      int 0..3 === IN 1...4
  // loudness   int 0...1 === 1-on 0-off
  // input gain int 0...3 === 0...11.25dB step 3.75 dB
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB
}



ISR(TIMER2_COMPA_vect){newPosition = myEnc.read()/4;}

void digit() {
  switch (a[i]) {
    case 0: d1 = 1, d2 = 8, d3 = 6, d4 = 1, d5 = 3, d6 = 6; break;
    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>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 20 Oct 2021 15:15:12 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=4794#p4794</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=4793#p4793</link>
			<description><![CDATA[<p>Вы уже используете библиотеку MsTimer2, использовать ISR (TIMER1_COMPA_vect){newPosition = myEnc.read()/4;} не нужно.</p><div class="codebox"><pre><code>#define IR_1 0x807F6897 // Кнопка вверх
#define IR_2 0x807F58A7 // Кнопка вниз
#define IR_3 0x807F0AF5 // Кнопка &gt;
#define IR_4 0x807F8A75 // Кнопка &lt;
#define IR_5 0x807F9867 // Кнопка IN
#define IR_6 0x807FC837 // Кнопка SET
#define IR_7 0x807F827D // Кнопка MUTE
#define IR_8 0x807F02FD // Кнопка STANDBY (POWER)
#define IR_9 0x807F8877 // Кнопка сон 10 минут
#define IR_10 0x807F728D // Кнопка вход 1
#define IR_11 0x807FB04F // Кнопка вход 2
#define IR_12 0x807F30CF // Кнопка вход 3
#define IR_13 0x807F52AD // Кнопка вход 4
#define BRIG 200        // Яркость подсветки экрана в режиме POWER OFF (0...255)
#define KOL 56 // максимальное значение регулировки подсветки
#define KOL1 14 // максимальное значение регулировки подсветки
#include &lt;Adafruit_NeoPixel.h&gt; // https://github.com/adafruit/Adafruit_NeoPixel.git
#include &lt;Wire.h&gt;
#include &lt;PT2314.h&gt;            // http://forum.rcl-radio.ru/misc.php?action=pan_download&amp;item=434&amp;download=1
#include &lt;Wire.h&gt;
#include &lt;LiquidCrystal_I2C.h&gt; // http://forum.rcl-radio.ru/misc.php?action=pan_download&amp;item=45&amp;download=1
#include &lt;Encoder.h&gt;           // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip       
#include &lt;EEPROM.h&gt;
#include &lt;MsTimer2.h&gt;          // http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip 
#include &lt;boarddefs.h&gt;
#include &lt;IRremote.h&gt;          // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include &lt;DS3231.h&gt;            // https://github.com/jarzebski/Arduino-DS3231/archive/master.zip
DS3231 clock;
RTCDateTime DateTime;
unsigned long times_son;
unsigned long times, oldPosition  = -56, newPosition;
bool son_k, son;
PT2314 pt;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, 11, NEO_GRB + NEO_KHZ800);     //подсветка 12 LED, D11
LiquidCrystal_I2C lcd(0x27, 16, 2); // Устанавливаем дисплей
IRrecv irrecv(12); // указываем вывод модуля IR приемника
Encoder myEnc(8, 9);// DT, CLK

decode_results ir;
byte v1[8] = {0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111};
byte v2[8] = {0b00111, 0b00111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
byte v3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v4[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v5[8] = {0b11100, 0b11100, 0b00000, 0b00000, 0b00000, 0b00000, 0b11100, 0b11100};
byte v6[8] = {0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100};
byte v7[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00111, 0b00111};
byte v8[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
byte a[6], d1, d2, d3, d4, d5, d6, e1, e2, e3, w, w2, i, www, power, save, gr1, gr2;
int menu, menu0, menu1 = 1, menu2 = 0, vol, bass, treb, att_l, att_r, in, loud_on, gain0, gain1, gain2, gain3, gain4, mute, mute1, mute2, brig, hour, minut, secon;
int poz, data;


void setup() {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  clock.begin();
  strip.begin();
  
  
  strip.setBrightness(35);
  poz = data / 12;
  irrecv.enableIRIn();

  pinMode(10, INPUT); // МЕНЮ КНОПКА SW энкодера
  pinMode(2, INPUT);  // КНОПКА SET
  pinMode(3, INPUT);  // КНОПКА IN
  pinMode(4, INPUT);  // КНОПКА MUTE
  pinMode(5, INPUT);  // КНОПКА STANDBY
  pinMode(7, OUTPUT); // ВЫХОД УПРАВЛЕНИЯ STANDBY
  pinMode(6, OUTPUT); // ВЫХОД УПРАВЛЕНИЯ ПОДСВЕТКОЙ
  analogWrite(6, 255);
  lcd.setCursor(0, 0);
  lcd.print(&quot;AmplifieR ClassA&quot;);
  lcd.setCursor(0, 1);
  lcd.print(&quot;    JLH 1969&quot;);
  delay(2000); lcd.clear(); // Меняем заставку
  MsTimer2::set(1, to_Timer);
  MsTimer2::start();

  //  clock.setDateTime(__DATE__, __TIME__); // Устанавливаем время на часах, основываясь на времени компиляции скетча

  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);

  if (EEPROM.read(100) != 0) {
    for (int i = 0; i &lt; 101; i++) {
      EEPROM.update(i, 0); // очистка памяти при первом включении
    }
  }
  vol = EEPROM.read(0);
  treb = EEPROM.read(1) - 7;
  bass = EEPROM.read(2) - 7;
  in = EEPROM.read(3);
  att_l = EEPROM.read(4);
  att_r = EEPROM.read(5);
  gain1 = EEPROM.read(6);
  gain2 = EEPROM.read(7);
  gain3 = EEPROM.read(8);
  gain4 = EEPROM.read(9);
  loud_on = EEPROM.read(10);
  brig = EEPROM.read(11);
  audio();
  analogWrite(6, brig);
}

void loop() {
  if (digitalRead(10) == LOW) {
    for (int i = 0; i &lt; 12; i++) {
      strip.setPixelColor(i, strip.Color(50, 0, 0));
    } strip.show(); delay(100);
    for (int i = 0; i &lt; 12; i++) {
      strip.setPixelColor(i, strip.Color(0, 0, 0));
    } strip.show();
  }
  DateTime = clock.getDateTime();
  hour = DateTime.hour;
  minut = DateTime.minute;
  secon = DateTime.second;

  ////////////////////// IR ///////////////////////////////////////////////////////////////

  if ( irrecv.decode( &amp;ir )) {
    Serial.print(&quot;0x&quot;);  // IR приемник - чтение, в мониторе порта отображаются коды кнопок
    Serial.println( ir.value, HEX);
    irrecv.resume();
    times = millis();
    w = 1;
  }
  if (ir.value == 0) {
    gr1 = 0;  // запрет нажатий не активных кнопок пульта
    gr2 = 0;
  }

  if (mute == 0 &amp;&amp; power == 0) {
    if (ir.value == IR_6 &amp;&amp; menu1 == 1) {
      menu1 = 0;
      menu2 = 1;
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;SYSTEM&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }
    if (ir.value == IR_6 &amp;&amp; menu2 == 1) {
      menu1 = 1;
      menu2 = 0;
      menu = 0;
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;AUDIO&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }

    if (ir.value == IR_1 &amp;&amp; menu1 == 1) {
      menu++;  //меню 1
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu &gt; 2) {
        menu = 0;
      }
    }
    if (ir.value == IR_2 &amp;&amp; menu1 == 1) {
      menu--;  //меню 1
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu &lt; 0) {
        menu = 2;
      }
    }

    if (ir.value == IR_1 &amp;&amp; menu2 == 1) {
      menu0++;  //меню 2
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu0 &gt; 4) {
        menu0 = 0;
      }
    }
    if (ir.value == IR_2 &amp;&amp; menu2 == 1) {
      menu0--;  //меню 2
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu0 &lt; 0) {
        menu0 = 4;
      }
    }

    if (ir.value == IR_5) {
      in++;  // IN
      gr1 = 0;
      gr2 = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (in &gt; 3) {
        in = 0;
      } lcd.setCursor(3, 0);
      switch (in) {
        case 0: lcd.print(&quot;  AUX  1&quot;); break;
        case 1: lcd.print(&quot;  AUX  2&quot;); break;
        case 2: lcd.print(&quot;  AUX  3&quot;); break;
        case 3: lcd.print(&quot;Bluetooth&quot;); break;
      }
      audio();
      delay(1000);
      lcd.clear();
    }
  }

  if (ir.value == IR_7 &amp;&amp; mute == 0 &amp;&amp; power == 0) {
    mute = 1;  // MUTE
    pt.setAttR(31);
    pt.setAttL(31);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.setCursor(6, 0);
    lcd.print(&quot;MUTE&quot;);
    menu1 = 100;
    menu2 = 100;
    delay(500);
  }
  if (ir.value == IR_7 &amp;&amp; mute == 1 &amp;&amp; power == 0) {
    mute = 0;  // MUTE
    cl();
    menu1 = 1;
    menu = 0;
    gr1 = 0;
    gr2 = 0;
    cl();
    audio();
  }

  if (ir.value == IR_8 &amp;&amp; power == 0) {
    power = 1;  // power off
    pt.setAttR(31);
    pt.setAttL(31);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    menu0 = 0;
    menu1 = 0;
    menu2 = 0;
    save = 1;
    analogWrite(6, BRIG);
    delay(1000);
    lcd.clear();
  }
  if (ir.value == IR_8 &amp;&amp; power == 1) {
    digitalWrite(7, HIGH);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER   ON &quot;);
    menu1 = 1;
    menu = 0;
    loud_on = 1;
    myEnc.write(0);
    audio();
    analogWrite(6, brig);
    delay(1000);
    power = 0;  // power on
    lcd.clear();
  }

  if (ir.value == IR_9) {
    cl(); son_k = 1;
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    lcd.setCursor(5, 1);
    lcd.print(&quot;10 MIN&quot;);
    delay(1000);
    lcd.clear();
  }
  if (son_k == 0) {
    times_son = millis();
  }
  if (millis() - times_son &gt; 600000) {                //Время таймера в милисек
    son = 1;
  }

  if ((ir.value == IR_8 &amp;&amp; power == 0) || son == 1) {
    power = 1;  // power off
    son = 0;  // power on
    son_k = 0;
    times_son = millis();
    pt.setAttR(31);
    pt.setAttL(31);
    audio();
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    menu0 = 0;
    menu1 = 0;
    menu2 = 0;
    save = 1;
    analogWrite(6, BRIG);
    delay(1000);
    lcd.clear();
  }
  if (ir.value == IR_8 &amp;&amp; power == 1) {
    power = 0;
    digitalWrite(7, HIGH);
    gr1 = 0;
    gr2 = 0;
    cl();
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER   ON &quot;);
    menu1 = 1;
    menu = 0;
    myEnc.write(0);
    audio();
    analogWrite(6, brig);
    delay(1000);
    lcd.clear();
  }
  if (ir.value == IR_10) {
    in = 0;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;  AUX  1&quot;);
    delay(1500);
  }
  if (ir.value == IR_11) {
    in = 1;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;  AUX  2&quot;);
    delay(1500);
  }
  if (ir.value == IR_12) {
    in = 2;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;  AUX  3&quot;);
    delay(1500);
  }
  if (ir.value == IR_13) {
    in = 3;
    gr1 = 0;
    gr2 = 0;
    cl();
    times = millis();
    w = 1;
    w2 = 1;
    audio();
    lcd.setCursor(3, 0);
    lcd.print(&quot;Bluetooth&quot;);
    delay(1500);
    lcd.clear();
  }

  /////////////////////////////// УПРАВЛЕНИЕ //////////////////////////////////////////////

  if (mute == 0 &amp;&amp; power == 0) {
    if (digitalRead(2) == HIGH &amp;&amp; menu1 == 1) {
      menu1 = 0;
      menu2 = 1;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;SYSTEM&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }
    if (digitalRead(2) == HIGH &amp;&amp; menu2 == 1) {
      menu1 = 1;
      menu2 = 0;
      menu = 0;
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      lcd.setCursor(3, 0);
      lcd.print(&quot;AUDIO&quot;);
      lcd.setCursor(6, 1);
      lcd.print(&quot;SETTINGS&quot;);
      delay(1000);
      lcd.clear();
    }

    if (digitalRead(10) == LOW &amp;&amp; menu1 == 1) {
      menu++;  //меню 1
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu &gt; 2) {
        menu = 0;
      }
    }
    if (digitalRead(10) == LOW &amp;&amp; menu2 == 1) {
      menu0++;  //меню 2
      cl();
      times = millis();
      w = 1;
      w2 = 1;
      if (menu0 &gt; 4) {
        menu0 = 0;
      }
    }

    if (digitalRead(3) == HIGH) {
      in++;  // IN
      cl();;
      times = millis();
      w = 1;
      w2 = 1;
      if (in &gt; 3) {
        in = 0;
      } lcd.setCursor(3, 0);
      switch (in) {
        case 0: lcd.print(&quot;  AUX  1&quot;); break;
        case 1: lcd.print(&quot;  AUX  2&quot;); break;
        case 2: lcd.print(&quot;  AUX  3 &quot;); break;
        case 3: lcd.print(&quot;Bluetooth&quot;); break;
      }
      audio();
      delay(1000);
      lcd.clear();
    }
  }

  if (digitalRead(4) == HIGH &amp;&amp; mute == 0 &amp;&amp; power == 0) {
    mute = 1;  // MUTE
    pt.setAttR(31);
    pt.setAttL(31);
    cl();
    lcd.setCursor(6, 0);
    lcd.print(&quot;MUTE&quot;);
    menu1 = 100;
    menu2 = 100;
    delay(500);
  }
  if (digitalRead(4) == HIGH &amp;&amp; mute == 1 &amp;&amp; power == 0) {
    mute = 0;  // MUTE
    cl();
    menu1 = 1;
    menu = 0;
    cl();
    audio();
  }

  if (digitalRead(5) == HIGH &amp;&amp; power == 0) {
    power = 1;  // power off
    pt.setAttR(31);
    pt.setAttL(31);
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER  OFF&quot;);
    menu0 = 0;
    menu1 = 0;
    menu2 = 0;
    save = 1;
    analogWrite(6, BRIG);
    delay(1000);
    lcd.clear();
  }
  if (power == 0) {
    digitalWrite(7, HIGH);
  }
  if (digitalRead(5) == HIGH &amp;&amp; power == 1) {
    power = 0;  // power on
    digitalWrite(7, HIGH);
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print(&quot;POWER   ON &quot;);
    menu1 = 1;
    menu = 0;
    delay(1000);
    myEnc.write(0);
    audio();
    analogWrite(6, brig);
    lcd.clear();
  }

  //if(power==0){digitalWrite(7,LOW);}// инверсия выхода STANDBY

  if (save == 1 &amp;&amp; w2 == 1) {
    save = 0; w2 = 0;
    EEPROM.update(0, vol);
    EEPROM.update(1, treb + 7);
    EEPROM.update(2, bass + 7);
    EEPROM.update(3, in);
    EEPROM.update(4, att_l);
    EEPROM.update(5, att_r);
    EEPROM.update(6, gain1);
    EEPROM.update(7, gain2);
    EEPROM.update(8, gain3);
    EEPROM.update(9, gain4);
    EEPROM.update(10, loud_on);
    EEPROM.update(11, brig);
  }

  ////////////// VOLUME ///////////////////////////////////////////////////////////////////

  if (menu == 0 &amp;&amp; menu1 == 1) {
    if (ir.value == IR_3) {
      vol++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      vol++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    if (ir.value == IR_4) {
      vol--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      vol--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      vol = vol + newPosition;
      oldPosition = newPosition;
      data = data + newPosition; if (data &gt;= 0 &amp;&amp; data &lt;= KOL) {
        poz = poz + newPosition;
        times = millis();
      }
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      strip.setPixelColor(poz - 1, strip.Color(0, 0, 0));
      strip.setPixelColor(poz, strip.Color(data, 0 + data / 10, KOL - data));
      strip.setPixelColor(poz + 1, strip.Color(0, 0, 0));

      if (poz &gt; 11) {
        poz = 0;
      } if (poz &lt; 0) {
        poz = poz + 12;
      }
      if (data &lt; 0) {
        data = 0;
      } if (data &gt; KOL) {
        data = KOL;
      }
      strip.show();
      times = millis();
      w = 1;
      w2 = 1;
      vol_func();
      audio();
    }
    a[0] = vol / 10; a[1] = vol % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;IN&quot;); lcd.print(in + 1); lcd.print(&quot;  VOL&quot;);
    if (vol &lt; 0) {
      lcd.setCursor(9, 1);
      lcd.write((uint8_t)8);
    } else {
      lcd.setCursor(9, 1);
      lcd.print(&quot; &quot;);
    }
    times_f();
  }

  ////////////// BASS ///////////////////////////////////////////////////////////////////

  if (menu == 1 &amp;&amp; menu1 == 1) {
    if (ir.value == IR_3) {
      bass++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      bass++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    if (ir.value == IR_4) {
      bass--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      bass--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      bass = bass + newPosition;
      oldPosition = newPosition;
      data = data + newPosition; if (data &gt;= 0 &amp;&amp; data &lt;= KOL1) {
        poz = poz + newPosition;
      }      
      myEnc.write(0);
      newPosition = 0;
      
      strip.setPixelColor(poz - 1, strip.Color(0, 0, 0));
      strip.setPixelColor(poz, strip.Color(data, 0 + data / 10, KOL1 - data));
      strip.setPixelColor(poz + 1, strip.Color(0, 0, 0));

      if (poz &gt; 11) {
        poz = 0;
      } if (poz &lt; 0) {
        poz = poz + 12;
      }
      if (data &lt; 0) {
        data = 0;
      } if (data &gt; KOL1) {
        data = KOL1;
      }
      strip.show();
      times = millis();
      w = 1;
      w2 = 1;
      bass_func();
      audio();
    }
    a[0] = abs(bass * 2) / 10; a[1] = abs(bass * 2) % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;BASS   dB&quot;);
    if (bass &lt; 0) {
      lcd.setCursor(9, 1);
      lcd.write((uint8_t)8);
    } else {
      lcd.setCursor(9, 1);
      lcd.print(&quot; &quot;);
    }
    times_f();
  }

  ////////////// TREBLE ///////////////////////////////////////////////////////////////////

  if (menu == 2 &amp;&amp; menu1 == 1) {
    if (ir.value == IR_3) {
      treb++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      treb++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    if (ir.value == IR_4) {
      treb--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      treb--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      treb = treb + newPosition;
      oldPosition = newPosition;
      data = data + newPosition; if (data &gt;= 0 &amp;&amp; data &lt;= KOL1) {
        poz = poz + newPosition;
      }      
      myEnc.write(0);
      newPosition = 0;
      
      strip.setPixelColor(poz - 1, strip.Color(0, 0, 0));
      strip.setPixelColor(poz, strip.Color(data, 0 + data / 10, KOL1 - data));
      strip.setPixelColor(poz + 1, strip.Color(0, 0, 0));

      if (poz &gt; 11) {
        poz = 0;
      } if (poz &lt; 0) {
        poz = poz + 12;
      }
      if (data &lt; 0) {
        data = 0;
      } if (data &gt; KOL1) {
        data = KOL1;
      }
      strip.show();
      times = millis();
      w = 1;
      w2 = 1;
      treb_func();
      audio();
    }
    a[0] = abs(treb * 2) / 10; a[1] = abs(treb * 2) % 10;

    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;TREBLE dB&quot;);
    if (treb &lt; 0) {
      lcd.setCursor(9, 1);
      lcd.write((uint8_t)8);
    } else {
      lcd.setCursor(9, 1);
      lcd.print(&quot; &quot;);
    }
    times_f();
  }

  ////////////// ATT_L ///////////////////////////////////////////////////////////////////

  if (menu0 == 0 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      att_l++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      att_l++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    if (ir.value == IR_4) {
      att_l--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      att_l--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      att_l = att_l + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      att_l_func();
      audio();
    }
    a[0] = abs(att_l) / 10; a[1] = abs(att_l) % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;ATT_L&quot;);
    lcd.setCursor(0, 1); lcd.print(-att_l * 1.25, 2);
    lcd.print(&quot; &quot;); lcd.setCursor(6, 1); lcd.print(&quot;dB&quot;);
  }

  ////////////// ATT_R ///////////////////////////////////////////////////////////////////

  if (menu0 == 1 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      att_r++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      att_r++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    if (ir.value == IR_4) {
      att_r--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      att_r--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      att_r = att_r + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      att_r_func();
      audio();
    }
    a[0] = abs(att_r) / 10; a[1] = abs(att_r) % 10;
    for (i = 0; i &lt; 2; i++) {
      switch (i) {
        case 0: e1 = 10, e2 = 11, e3 = 12;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;ATT_R&quot;);
    lcd.setCursor(0, 1); lcd.print(-att_r * 1.25, 2);
    lcd.print(&quot; &quot;); lcd.setCursor(6, 1); lcd.print(&quot;dB&quot;);
  }

  ////////////// INPUT GAIN ///////////////////////////////////////////////////////////////////

  if (menu0 == 2 &amp;&amp; menu2 == 1) {
    switch (in) {
      case 0: gain0 = gain1; break;
      case 1: gain0 = gain2; break;
      case 2: gain0 = gain3; break;
      case 3: gain0 = gain4; break;
    }

    if (ir.value == IR_3) {
      gain0++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      gain0++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }
    if (ir.value == IR_4) {
      gain0--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      gain0--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      gain_func();
      www = 1;
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      gain0 = gain0 + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      www = 1;
      w = 1;
      w2 = 1;
      gain_func();
    }

    switch (in) {
      case 0: gain1 = gain0; break;
      case 1: gain2 = gain0; break;
      case 2: gain3 = gain0; break;
      case 3: gain4 = gain0; break;
    }
    a[0] = abs(gain0);

    for (i = 0; i &lt; 1; i++) {
      switch (i) {
        case 0: e1 = 13, e2 = 14, e3 = 15;
          break;
        case 1: e1 = 13, e2 = 14, e3 = 15;
          break;
      } digit();
    }
    lcd.setCursor(0, 1); lcd.print(&quot;GAIN &quot;); lcd.print(gain0 * 3.75, 2); lcd.print(&quot; &quot;); lcd.setCursor(10, 1); lcd.print(&quot;dB&quot;);
    if (www == 1) {
      audio();
      www = 0;
    }
    lcd.setCursor(0, 0); lcd.print(&quot;INPUT &quot;); lcd.print(in + 1);
  }

  ////////////// LOUDNESS ///////////////////////////////////////////////////////////////////

  if (menu0 == 3 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      loud_on++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      loud_on++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }
    if (ir.value == IR_4) {
      loud_on--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      loud_on--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      } audio();
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      loud_on = loud_on + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      if (loud_on &gt; 1) {
        loud_on = 1;
      };
      if (loud_on &lt; 0) {
        loud_on = 0;
      };
      audio();
    }
    if (loud_on == 1) {
      lcd.setCursor(2, 0);
      lcd.print(&quot;LOUDNESS  ON &quot;);
      delay(200);
    } else {
      lcd.setCursor(2, 0);
      lcd.print(&quot;LOUDNESS  OFF&quot;);
      delay(200);
    }
  }

  ////////////// BRIGHTNESS ///////////////////////////////////////////////////////////////////

  if (menu0 == 4 &amp;&amp; menu2 == 1) {
    if (ir.value == IR_3) {
      brig++;  // кнопка &gt;
      gr1 = 1;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    if (ir.value == 0xFFFFFFFF and gr1 == 1) {
      brig++;  // кнопка &gt;&gt;&gt;&gt;&gt;&gt;
      gr2 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    if (ir.value == IR_4) {
      brig--;  // кнопка &lt;
      gr1 = 0;
      gr2 = 1;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    if (ir.value == 0xFFFFFFFF and gr2 == 1) {
      brig--;  // кнопка &lt;&lt;&lt;&lt;&lt;&lt;
      gr1 = 0;
      cl1();
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }

    if (newPosition != oldPosition) {
      oldPosition = newPosition;
      brig = brig + newPosition;
      myEnc.write(0);
      newPosition = 0;
      times = millis();
      w = 1;
      w2 = 1;
      brig_func();
      analogWrite(6, brig);
    }
    a[0] = abs(brig) / 100; a[1] = abs(brig) / 10 % 10; a[2] = abs(brig) % 10;
    for (i = 0; i &lt; 3; i++) {
      switch (i) {
        case 0: e1 = 7, e2 = 8, e3 = 9; break;
        case 1: e1 = 10, e2 = 11, e3 = 12; break;
        case 2: e1 = 13, e2 = 14, e3 = 15; break;
      } digit();
    }

    lcd.setCursor(0, 0); lcd.print(&quot;BRIGHT&quot;);
    lcd.setCursor(0, 1); lcd.print(brig * 100 / 255); lcd.print(&quot; &quot;); lcd.setCursor(4, 1); lcd.print(&quot;%&quot;);
  }
  ////////////////////////////////////////////////////////////////////////////////////////////

  if (millis() - times &gt; 10000 &amp;&amp; w == 1 &amp;&amp; mute == 0 &amp;&amp; power == 0) {
    w = 0;
    menu2 = 0;
    menu1 = 1;
    menu = 0;
    cl();
  }

  /////////////////// ЧАСЫ ///////////////////////////////////////////////////////////////////

  if (power == 1) {
    digitalWrite(7, LOW);
    a[0] = DateTime.hour / 10;
    a[1] = DateTime.hour % 10;
    a[2] = DateTime.minute / 10;
    a[3] = DateTime.minute % 10;
    a[4] = DateTime.second / 10;
    a[5] = DateTime.second % 10;
    for (i = 0; i &lt; 4; i++) {
      switch (i) {
        case 0: e1 = 0, e2 = 1, e3 = 2; break;
        case 1: e1 = 3, e2 = 4, e3 = 5; break;
        case 2: e1 = 7, e2 = 8, e3 = 9; break;
        case 3: e1 = 10, e2 = 11, e3 = 12; break;
      } digit();
    }

    lcd.setCursor(6, 0); lcd.print(&quot;.&quot;); lcd.setCursor(6, 1); lcd.print(&quot;.&quot;);
    lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
    //// set time ////
    if (digitalRead(10) == LOW &amp;&amp; digitalRead(2) == HIGH) {
      hour++;
      if (hour &gt; 23) {
        hour = 0;
      } clock.setDateTime(2020, 9, 15, hour, minut, secon);
      delay(100);
    }
    if (digitalRead(10) == LOW &amp;&amp; digitalRead(3) == HIGH) {
      minut++;
      if (minut &gt; 59) {
        minut = 0;
      } clock.setDateTime(2020, 9, 15, hour, minut, secon);
      delay(100);
    }
    if (digitalRead(10) == LOW &amp;&amp; digitalRead(4) == HIGH) {
      secon = 0;
      clock.setDateTime(2020, 9, 15, hour, minut, secon);
      delay(100);
    }
  }

}/////////////// loop end

void times_f() {
  lcd.setCursor(0, 1);
  lcd.print(DateTime.hour / 10);
  lcd.print(DateTime.hour % 10);
  lcd.print(&quot;:&quot;);
  lcd.print(DateTime.minute / 10);
  lcd.print(DateTime.minute % 10);
  lcd.print(&quot;:&quot;);
  lcd.print(DateTime.second / 10);
  lcd.print(DateTime.second % 10);
}
void brig_func() {
  if (brig &lt; 0) {
    brig = 0;
  } if (brig &gt; 255) {
    brig = 255;
  }
}
void gain_func() {
  if (gain0 &lt; 0) {
    gain0 = 0;
  } if (gain0 &gt; 3) {
    gain0 = 3;
  }
}
void att_r_func() {
  if (att_r &lt; 0) {
    att_r = 0;
  } if (att_r &gt; 24) {
    att_r = 24;
  }
}
void att_l_func() {
  if (att_l &lt; 0) {
    att_l = 0;
  } if (att_l &gt; 24) {
    att_l = 24;
  }
}
void treb_func() {
  if (treb &lt; -7) {
    treb = -7;
  } if (treb &gt; 7) {
    treb = 7;
  }
}
void bass_func() {
  if (bass &lt; -7) {
    bass = -7;
  } if (bass &gt; 7) {
    bass = 7;
  }
}
void vol_func() {
  if (vol &lt; 0) {
    vol = 0;
  } if (vol &gt; 56) {
    vol = 56;
  }
}
void cl() {
  ir.value = 0;
  delay(300);
  lcd.clear();
}
void cl1() {
  ir.value = 0;
  delay(200);
}
void audio() {
  pt.setVolume(vol); // int 0...56 === -70...0 dB step 1.25 dB
  pt.setAttL(att_l); // int 0...24 === 0...-30 db step 1.25 dB &gt; int 31 === mute on
  pt.setAttR(att_r); // int 0...24 === 0...-30 dB step 1.25 dB &gt; int 31 === mute on
  pt.setSwitch(in, loud_on , gain0);
  // input      int 0..3 === IN 1...4
  // loudness   int 0...1 === 1-on 0-off
  // input gain int 0...3 === 0...11.25dB step 3.75 dB
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB
}

void to_Timer() {
  newPosition = myEnc.read() / 4;
}


void digit() {
  switch (a[i]) {
    case 0: d1 = 1, d2 = 8, d3 = 6, d4 = 1, d5 = 3, d6 = 6; break;
    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>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 20 Oct 2021 15:08:16 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=4793#p4793</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=4791#p4791</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>не проходит компиляцию с ошибкой не для НАНО</p></blockquote></div><p>Какой контроллер?</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 20 Oct 2021 15:02:17 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=4791#p4791</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=2010#p2010</link>
			<description><![CDATA[<p>При подключении линейки светодиодов при погасании последнего светодиода будет загораться первый? Этот скетч подходит только для кольца. У меня нет линейки светодиодов, чтобы написать скетч и протестировать его.</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Tue, 11 Aug 2020 01:47:43 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=2010#p2010</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=2009#p2009</link>
			<description><![CDATA[<p>Устранил согласно рекомендаций. Все заработало. <br />Вопрос: что изменить в программе, чтобы подключить не кольцо, а линейку из светодиодов, например, из 16 или 24 светодиодов. <br />Есть замысел сделать учебный макет для оценки угла зрения, там нужно не кольцо, а линейка.</p>]]></description>
			<author><![CDATA[null@example.com (valerii)]]></author>
			<pubDate>Mon, 10 Aug 2020 19:28:23 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=2009#p2009</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=1966#p1966</link>
			<description><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2020/08/11dd0d7b0acb4ed8115a786a5fe4dd71.png" alt="http://forum.rcl-radio.ru/uploads/images/2020/08/11dd0d7b0acb4ed8115a786a5fe4dd71.png" /></span> <br /><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2020/08/77ae1886b199ac2e9f7af0e0f7d2629e.png" alt="http://forum.rcl-radio.ru/uploads/images/2020/08/77ae1886b199ac2e9f7af0e0f7d2629e.png" /></span> <br /><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2020/08/932335b8daa7a5c4c183af8f4226f209.png" alt="http://forum.rcl-radio.ru/uploads/images/2020/08/932335b8daa7a5c4c183af8f4226f209.png" /></span> </p><div class="codebox"><pre><code>#include &lt;Adafruit_NeoPixel.h&gt; // https://github.com/adafruit/Adafruit_NeoPixel.git
#include &lt;Encoder.h&gt;  // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
  Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, 6, NEO_GRB + NEO_KHZ800);// 8 LED, D6
  Encoder myEnc(9, 8);//CLK, DT
  unsigned long oldPosition  = -999,newPosition;
  int poz,data=30;
  #define KOL 79
  
void setup(){  
  OCR1A = 5000; TCCR1B |= (1 &lt;&lt; WGM12)|(1 &lt;&lt; CS10); TIMSK1 |= (1 &lt;&lt; OCIE1A);
  strip.begin();Serial.begin(9600);
  pinMode(7,INPUT);
  strip.setBrightness(32);
  poz = data/8;
}

void loop(){ 
   if(digitalRead(7)==LOW){
    for(int i=0;i&lt;8;i++){strip.setPixelColor(i, strip.Color(0, 50, 0));}strip.show();delay(300);
    for(int i=0;i&lt;8;i++){strip.setPixelColor(i, strip.Color(0, 0, 0));}strip.show();}
    
   if (newPosition != oldPosition) {oldPosition = newPosition;
    data=data+newPosition;if(data&gt;=0&amp;&amp;data&lt;=KOL){poz=poz+newPosition;}myEnc.write(0);newPosition=0;
    Serial.println(data);}
   
    strip.setPixelColor(poz-1, strip.Color(0, 0, 0));
    strip.setPixelColor(poz, strip.Color(data, 0+data/10, KOL-data));
    strip.setPixelColor(poz+1, strip.Color(0, 0, 0)); 
    
  if(poz&gt;7){poz=0;}if(poz&lt;0){poz=poz+8;}
  if(data&lt;0){data=0;}if(data&gt;KOL){data=KOL;}
    strip.show();
}// LOOP
ISR (TIMER1_COMPA_vect){newPosition = myEnc.read()/4;}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Thu, 06 Aug 2020 07:29:47 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=1966#p1966</guid>
		</item>
		<item>
			<title><![CDATA[Re: RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=1822#p1822</link>
			<description><![CDATA[<p>4 кнопки управления:<br />1 и 2 яркость +\-<br />3 - выбор режима<br />4 - программное вкл.выкл</p><p>яркость программно ограничена до 52 Вт на 5 метров для ИП 60 Вт</p><p><div class="fancy_video_tag_player"><iframe class="youtube-player" type="text/html" width="640" height="385" src="https://www.youtube.com/embed/IfLxcUiOCv4" frameborder="0"></iframe></div></p><div class="codebox"><pre><code>#include &lt;Adafruit_NeoPixel.h&gt;
#include &lt;EEPROM.h&gt;
#define LED_PIN    6
#define LED_COUNT 300
#define BRIG_MAX 200
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

int brig,w,sett;
unsigned long times,off;

void setup() {Serial.begin(9600);
  strip.begin();           
  strip.show();            
  pinMode(A0,INPUT_PULLUP); //  +
  pinMode(A1,INPUT_PULLUP); //  -
  pinMode(A2,INPUT_PULLUP); //  set
  pinMode(A3,INPUT_PULLUP); //  on/off
  
  brig = EEPROM.read(0);sett = EEPROM.read(1);
}

void loop() {
  if(analogRead(A0)&lt;100){brig++;if(brig&gt;BRIG_MAX){brig=BRIG_MAX;}delay(50);w=1;}
  if(analogRead(A1)&lt;100){brig--;if(brig&lt;0){brig=0;}delay(50);w=1;}
  if(analogRead(A2)&lt;100){sett++;if(sett&gt;5){sett=0;}delay(1000);;w=1;}
  if(analogRead(A3)&lt;100&amp;&amp;off==0){off=1;for(int i=0;i&lt;300;i++){strip.setPixelColor(i, strip.Color(0, 0, 0));}strip.show();delay(1000);}
  if(analogRead(A3)&lt;100&amp;&amp;off==1){off=0;delay(1000);}
  strip.setBrightness(brig);
  if(off==0){
  switch(sett){
  case 0:  rgb0();break;
  case 1:  rgb1(1);break;
  case 2:  rgb2(50);break;
  case 3:   
  rgb3(strip.Color(255,   0,   0), 5); // Red
  rgb3(strip.Color(  0, 255,   0), 5); // Green
  rgb3(strip.Color(  0,   0, 255), 5); // Blue
  break;
  case 4:  rgb4();break;
  case 5:  rgb5();break;
  }     

//////////// EEPROM /////////////
  if(millis()-times&gt;10000&amp;&amp;w==1){w=0;times=millis();
    EEPROM.update(0,brig);EEPROM.update(1,sett);
    }}
}



void rgb0(){for(int i=0;i&lt;300;i++){strip.setPixelColor(i, strip.Color(255, 255, 255));}strip.show();}
void rgb5(){for(int i=0;i&lt;300;i++){strip.setPixelColor(i, strip.Color(255, 50, 255));}strip.show();}
void rgb4(){for(int i=0;i&lt;300;i++){ if(analogRead(A2)&lt;100||analogRead(A3)&lt;100){break;}brigg();
  if(i%2){strip.setPixelColor(i, strip.Color(255, 255, 255));}
  else{strip.setPixelColor(i, strip.Color(0, 0, 0));}
  strip.show();}}
 

void rgb1(int wait) { 
  for(long firstPixelHue = 0; firstPixelHue &lt; 5*65536; firstPixelHue += 256) {
    if(analogRead(A2)&lt;100||analogRead(A3)&lt;100||analogRead(A3)&lt;100){break;}brigg();
    for(int i=0; i&lt;strip.numPixels(); i++) {  
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));}
    strip.show();delay(wait);}}

void rgb2(int wait) {
  int firstPixelHue = 0;    
  for(int a=0; a&lt;30; a++) { 
    if(analogRead(A2)&lt;100||analogRead(A3)&lt;100){break;}brigg();
    for(int b=0; b&lt;3; b++) {strip.clear();        
      for(int c=b; c&lt;strip.numPixels(); c += 3) {
        int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
        uint32_t color = strip.gamma32(strip.ColorHSV(hue)); 
        strip.setPixelColor(c, color);}
      strip.show();delay(wait);firstPixelHue += 65536 / 90; }}}

void rgb3(uint32_t color, int wait) {
  for(int i=0; i&lt;strip.numPixels(); i++) { 
    if(analogRead(A2)&lt;100){break;}brigg();
    strip.setPixelColor(i, color);strip.show();delay(wait);}}      

void brigg(){
  if(analogRead(A0)&lt;100){brig++;if(brig&gt;BRIG_MAX){brig=BRIG_MAX;};w=1;strip.setBrightness(brig);}
  if(analogRead(A1)&lt;100){brig--;if(brig&lt;0){brig=0;}w=1;strip.setBrightness(brig);}
  }
  </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Mon, 22 Jun 2020 06:16:16 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=1822#p1822</guid>
		</item>
		<item>
			<title><![CDATA[RGB лента]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=1787#p1787</link>
			<description><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2020/06/da0a271fff7686f7df2344653bd8a23e.png" alt="http://forum.rcl-radio.ru/uploads/images/2020/06/da0a271fff7686f7df2344653bd8a23e.png" /></span> </p><p>Библиотека - <a href="https://github.com/adafruit/Adafruit_NeoPixel.git">https://github.com/adafruit/Adafruit_NeoPixel.git</a></p><p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2020/06/f2503954063d1967b774e7b4ac3872a2.png" alt="http://forum.rcl-radio.ru/uploads/images/2020/06/f2503954063d1967b774e7b4ac3872a2.png" /></span> </p><br /><p><span class="attention-yellow"></span> </p><p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2020/06/63c6a717bd2420499951f8469b44dbd3.png" alt="http://forum.rcl-radio.ru/uploads/images/2020/06/63c6a717bd2420499951f8469b44dbd3.png" /></span> </p><p>U = 12 V 60 X 1M<br />1M = 1.08A = 12.96 W<br />5M = 5.4A = 64 W</p><br /><div class="codebox"><pre><code>#include &lt;Adafruit_NeoPixel.h&gt;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, 6, NEO_GRB + NEO_KHZ800);// 4 трека, D6

void setup(){
  strip.begin();
}

void loop(){ 
    strip.setPixelColor(0, strip.Color(5, 45, 90)); 
    strip.setPixelColor(1, strip.Color(23, 255, 120)); 
    strip.setPixelColor(2, strip.Color(1, 0, 50)); 
    strip.setPixelColor(3, strip.Color(127, 0, 0)); 
    strip.show();
    delay(500);
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 19 Jun 2020 07:24:08 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=1787#p1787</guid>
		</item>
	</channel>
</rss>
