Управление регулятором тембра и громкости РТ2314 раделено на два меню.
Основное меню: громкость, тембр НЧ, тембр ВЧ
Меню настроек: Аттенюаторы ПК и ЛК, регулировка предусилителя независимое для каждого входа, LOUDNESS, регулировка яркости подсветки экрана.
Подсветка - убрать перемычку с модуля I2C PCF8574 и подключить вывод модуля к цифровому выходу Арудио D6. Перед подключением замерить ток подсветки который не должен превышать 20 мА (у меня не более 15 мА, замер производить между контактами перемычки)
Коррекция времени: Перейти в режим POWER OFF, нажать и удерживать кнопку энкодера, для корректировки часов нажать кнопку SET, для минут IN, для сброса секунд MUTE.
#define IR_1 0x2FDD02F // Кнопка вверх
#define IR_2 0x2FD32CD // Кнопка вниз
#define IR_3 0x2FD906F // Кнопка >
#define IR_4 0x2FDF20D // Кнопка <
#define IR_5 0x2FD708F // Кнопка IN
#define IR_6 0x2FD6A95 // Кнопка SET
#define IR_7 0x2FD00FF // Кнопка MUTE
#define IR_8 0x2FDB24D // Кнопка STANDBY (POWER)
#define BRIG 50 // Яркость подсветки экрана в режиме POWER OFF (0...255)
#include <Wire.h>
#include <PT2314.h> // http://forum.rcl-radio.ru/misc.php?action=pan_download&item=434&download=1
#include <Wire.h>
#include <LiquidCrystal_I2C.h> // http://forum.rcl-radio.ru/misc.php?action=pan_download&item=45&download=1
#include <Encoder.h> // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
#include <EEPROM.h>
#include <MsTimer2.h> // http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip
#include <boarddefs.h>
#include <IRremote.h> // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <DS3231.h> // https://github.com/jarzebski/Arduino-DS3231/archive/master.zip
DS3231 clock;RTCDateTime DateTime;
PT2314 pt;
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;
unsigned long times,oldPosition = -999,newPosition;
void setup() {
irrecv.enableIRIn();lcd.init();lcd.backlight();clock.begin();Serial.begin(9600);
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("Sound Processor");lcd.setCursor(0,1);lcd.print("PT2314"); 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<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*25);
}
void loop() {
DateTime = clock.getDateTime();hour = DateTime.hour;minut = DateTime.minute;secon = DateTime.second;
////////////////////// IR ///////////////////////////////////////////////////////////////
if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);irrecv.resume();times=millis();w=1;}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
if(ir.value==0){gr1=0;gr2=0;}// запрет нажатий не активных кнопок пульта
if(mute==0&&power==0){
if(ir.value==IR_6&&menu1==1){menu1=0;menu2=1;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;lcd.setCursor(4,0);lcd.print("SETTING"); delay(2000);lcd.clear();}
if(ir.value==IR_6&&menu2==1){menu1=1;menu2=0;menu=0;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;lcd.setCursor(6,0);lcd.print("MENU"); delay(2000);lcd.clear();}
if(ir.value==IR_1&&menu1==1){menu++;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;if(menu>2){menu=0;}}//меню 1
if(ir.value==IR_2&&menu1==1){menu--;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;if(menu<0){menu=2;}}//меню 1
if(ir.value==IR_1&&menu2==1){menu0++;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;if(menu0>4){menu0=0;}}//меню 2
if(ir.value==IR_2&&menu2==1){menu0--;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;if(menu0<0){menu0=4;}}//меню 2
if(ir.value==IR_5){in++;gr1=0;gr2=0;cl();times=millis();w=1;w2=1;if(in>3){in=0;}lcd.setCursor(4,0);lcd.print("INPUT ");lcd.print(in+1);audio();delay(2000);lcd.clear();}// IN
}
if(ir.value==IR_7&&mute==0&&power==0){mute=1;pt.setAttR(31);pt.setAttL(31);gr1=0;gr2=0;cl();lcd.setCursor(6,0);lcd.print("MUTE");menu1=100;menu2=100;delay(500);}// MUTE
if(ir.value==IR_7&&mute==1&&power==0){mute=0;cl();menu1=1;menu=0;gr1=0;gr2=0;cl();audio();}// MUTE
if(ir.value==IR_8&&power==0){power=1;pt.setAttR(31);pt.setAttL(31);audio();gr1=0;gr2=0;cl();lcd.clear();lcd.setCursor(3,0);lcd.print("POWER OFF");menu0=0;menu1=0;menu2=0;save=1;analogWrite(6, BRIG);delay(3000);lcd.clear();}// power off
if(ir.value==IR_8&&power==1){power=0;gr1=0;gr2=0;cl();lcd.backlight();lcd.clear();lcd.setCursor(3,0);lcd.print("POWER ON ");menu1=1;menu=0;myEnc.write(0);audio();analogWrite(6, brig*25);delay(3000);lcd.clear();}// power on
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// УПРАВЛЕНИЕ //////////////////////////////////////////////
if(mute==0&&power==0){
if(digitalRead(2)==HIGH&&menu1==1){menu1=0;menu2=1;cl();times=millis();w=1;w2=1;lcd.setCursor(4,0);lcd.print("SETTING"); delay(2000);lcd.clear();}
if(digitalRead(2)==HIGH&&menu2==1){menu1=1;menu2=0;menu=0;cl();times=millis();w=1;w2=1;lcd.setCursor(6,0);lcd.print("MENU"); delay(2000);lcd.clear();}
if(digitalRead(10)==LOW&&menu1==1){menu++;cl();times=millis();w=1;w2=1;if(menu>2){menu=0;}}//меню 1
if(digitalRead(10)==LOW&&menu2==1){menu0++;cl();times=millis();w=1;w2=1;if(menu0>4){menu0=0;}}//меню 2
if(digitalRead(3)==HIGH){in++;cl();;times=millis();w=1;w2=1;if(in>3){in=0;}lcd.setCursor(4,0);lcd.print("INPUT ");lcd.print(in+1);audio();delay(2000);lcd.clear();}// IN
}
if(digitalRead(4)==HIGH&&mute==0&&power==0){mute=1;pt.setAttR(31);pt.setAttL(31);cl();lcd.setCursor(6,0);lcd.print("MUTE");menu1=100;menu2=100;delay(500);}// MUTE
if(digitalRead(4)==HIGH&&mute==1&&power==0){mute=0;cl();menu1=1;menu=0;cl();audio();}// MUTE
if(digitalRead(5)==HIGH&&power==0){power=1;pt.setAttR(31);pt.setAttL(31);lcd.clear();lcd.setCursor(3,0);lcd.print("POWER OFF");menu0=0;menu1=0;menu2=0;save=1;analogWrite(6, 50);delay(3000);lcd.clear();}// power off
if(digitalRead(5)==HIGH&&power==1){power=0;lcd.backlight();lcd.clear();lcd.setCursor(3,0);lcd.print("POWER ON ");menu1=1;menu=0;myEnc.write(0);audio();analogWrite(6, brig*25);delay(3000);lcd.clear();}// power on
if(power==0){digitalWrite(7,HIGH);}
//if(power==0){digitalWrite(7,LOW);}// инверсия выхода STANDBY
if(save==1&&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&&menu1==1){
if(ir.value==IR_3){vol++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;vol_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl1();times=millis();w=1;w2=1;vol_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){vol--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;vol_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl1();times=millis();w=1;w2=1;vol_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;vol=vol+newPosition;myEnc.write(0);newPosition=0;times=millis();w=1;w2=1;vol_func();audio();}
a[0]= vol/10;a[1]=vol%10;
for(i=0;i<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("IN");lcd.print(in+1);lcd.print(" VOL");
if(vol<0){lcd.setCursor(9,1);lcd.write((uint8_t)8);}else{lcd.setCursor(9,1);lcd.print(" ");}
times_f();
}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// BASS ///////////////////////////////////////////////////////////////////
if(menu==1&&menu1==1){
if(ir.value==IR_3){bass++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;bass_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl1();times=millis();w=1;w2=1;bass_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){bass--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;bass_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl1();times=millis();w=1;w2=1;bass_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;bass=bass+newPosition;myEnc.write(0);newPosition=0;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<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("BASS dB");
if(bass<0){lcd.setCursor(9,1);lcd.write((uint8_t)8);}else{lcd.setCursor(9,1);lcd.print(" ");}
lcd.setCursor(0,1);lcd.print("TREBLE ");lcd.print(treb*2);
}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// TREBLE ///////////////////////////////////////////////////////////////////
if(menu==2&&menu1==1){
if(ir.value==IR_3){treb++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;treb_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl1();times=millis();w=1;w2=1;treb_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){treb--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;treb_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl1();times=millis();w=1;w2=1;treb_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;treb=treb+newPosition;myEnc.write(0);newPosition=0;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<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("TREBLE dB");
if(treb<0){lcd.setCursor(9,1);lcd.write((uint8_t)8);}else{lcd.setCursor(9,1);lcd.print(" ");}
lcd.setCursor(0,1);lcd.print("BASS ");lcd.print(bass*2);
}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// ATT_L ///////////////////////////////////////////////////////////////////
if(menu0==0&&menu2==1){
if(ir.value==IR_3){att_l++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;att_l_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){att_l++;gr2=0;cl1();times=millis();w=1;w2=1;att_l_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){att_l--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;att_l_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){att_l--;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<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("ATT_L");
lcd.setCursor(0,1);lcd.print(-att_l*1.25,2);lcd.print(" ");lcd.setCursor(6,1);lcd.print("dB");}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// ATT_R ///////////////////////////////////////////////////////////////////
if(menu0==1&&menu2==1){
if(ir.value==IR_3){att_r++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;att_r_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){att_r++;gr2=0;cl1();times=millis();w=1;w2=1;att_r_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){att_r--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;att_r_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){att_r--;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<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("ATT_R");
lcd.setCursor(0,1);lcd.print(-att_r*1.25,2);lcd.print(" ");lcd.setCursor(6,1);lcd.print("dB");}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// INPUT GAIN ///////////////////////////////////////////////////////////////////
if(menu0==2&&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++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;gain_func();www=1;}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){gain0++;gr2=0;cl1();times=millis();w=1;w2=1;gain_func();www=1;}// кнопка >>>>>>
if(ir.value==IR_4){gain0--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;gain_func();www=1;}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){gain0--;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<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("GAIN ");lcd.print(gain0*3.75,2);lcd.print(" ");lcd.setCursor(10,1);lcd.print("dB");
if(www==1){audio();www=0;}
lcd.setCursor(0,0);lcd.print("INPUT ");lcd.print(in+1);}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// LOUDNESS ///////////////////////////////////////////////////////////////////
if(menu0==3&&menu2==1){
if(ir.value==IR_3){loud_on++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;if(loud_on>1){loud_on=0;};if(loud_on<0){loud_on=1;}audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){loud_on++;gr2=0;cl1();times=millis();w=1;w2=1;if(loud_on>1){loud_on=0;};if(loud_on<0){loud_on=1;}audio();}// кнопка >>>>>>
if(ir.value==IR_4){loud_on--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;if(loud_on>1){loud_on=0;};if(loud_on<0){loud_on=1;}audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){loud_on--;gr1=0;cl1();times=millis();w=1;w2=1;if(loud_on>1){loud_on=0;};if(loud_on<0){loud_on=1;}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>1){loud_on=0;};if(loud_on<0){loud_on=1;};audio();}
if(loud_on==1){lcd.setCursor(2,0);lcd.print("LOUDNESS ON ");}
else{lcd.setCursor(2,0);lcd.print("LOUDNESS OFF");}}
////////////////////////////////////////////////////////////////////////////////////////////
////////////// BRIGHTNESS ///////////////////////////////////////////////////////////////////
if(menu0==4&&menu2==1){
if(ir.value==IR_3){brig++;gr1=1;gr2=0;cl1();times=millis();w=1;w2=1;brig_func();analogWrite(6,brig*25);}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){brig++;gr2=0;cl1();times=millis();w=1;w2=1;brig_func();analogWrite(6,brig*25);}// кнопка >>>>>>
if(ir.value==IR_4){brig--;gr1=0;gr2=1;cl1();times=millis();w=1;w2=1;brig_func();analogWrite(6,brig*25);}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){brig--;gr1=0;cl1();times=millis();w=1;w2=1;brig_func();analogWrite(6,brig*25);}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;brig=brig+newPosition;myEnc.write(0);newPosition=0;times=millis();w=1;w2=1;brig_func();analogWrite(6,brig*25);}
a[0]= abs(brig)/10;a[1]=abs(brig)%10;
for(i=0;i<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("BRIGHT");
lcd.setCursor(0,1);lcd.print(brig*10);lcd.print(" ");lcd.setCursor(4,1);lcd.print("%");}
////////////////////////////////////////////////////////////////////////////////////////////
if(millis()-times>10000&&w==1&&mute==0&&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<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(".");lcd.setCursor(6,1);lcd.print(".");
lcd.setCursor(14,1);lcd.print(a[4]);lcd.setCursor(15,1);lcd.print(a[5]);
//// set time ////
if(digitalRead(10)==LOW&&digitalRead(2)==HIGH){hour++;if(hour>23){hour=0;} clock.setDateTime(2020, 9, 15, hour, minut, secon);delay(100);}
if(digitalRead(10)==LOW&&digitalRead(3)==HIGH){minut++;if(minut>59){minut=0;} clock.setDateTime(2020, 9, 15, hour, minut, secon);delay(100); }
if(digitalRead(10)==LOW&&digitalRead(4)==HIGH){secon=0; clock.setDateTime(2020, 9, 15, hour, minut, secon);delay(100); }
}
////////////////////////////////////////////////////////////////////////////////////////////
}// loop
void times_f(){lcd.setCursor(0,1);lcd.print(DateTime.hour/10);lcd.print(DateTime.hour%10);lcd.print(":");lcd.print(DateTime.minute/10);lcd.print(DateTime.minute%10);lcd.print(":");lcd.print(DateTime.second/10);lcd.print(DateTime.second%10);}
void brig_func(){if(brig<0){brig=0;}if(brig>10){brig=10;}}
void gain_func(){if(gain0<0){gain0=0;}if(gain0>3){gain0=3;}}
void att_r_func(){if(att_r<0){att_r=0;}if(att_r>24){att_r=24;}}
void att_l_func(){if(att_l<0){att_l=0;}if(att_l>24){att_l=24;}}
void treb_func(){if(treb<-7){treb=-7;}if(treb>7){treb=7;}}
void bass_func(){if(bass<-7){bass=-7;}if(bass>7){bass=7;}}
void vol_func(){if(vol<0){vol=0;}if(vol>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 > int 31 === mute on
pt.setAttR(att_r); // int 0...24 === 0...-30 dB step 1.25 dB > 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);}