Тема: Темброблок на ис. TDA8425
При проверке скетча, выдает ошибку во второй строке: #include <TDA 8425.h>
No sucf file or directory.
#include <Wire.h>
#include <TDA8425.h>
#include <Encoder.h>
#include <LiquidCrystal.h>
#include <EEPROM.h>
#include <MsTimer2.h>
#include <boarddefs.h>
#include <IRremote.h>
IRrecv irrecv(9); // указываем вывод модуля IR приемника
Encoder myEnc(11, 10);//CLK, DT
decode_results ir;
TDA8425 tda;
LiquidCrystal lcd(7, 6, 2, 3, 4, 5);// RS,E,D4,D5,D6,D7
byte a1[8]={0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101};
byte a2[8]={0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100};
byte a3[8]={0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000};
int menu,vol,vol_d,balans,bass,bass_d,treb,treb_d,in,mute,sss;
byte w,w2,standby=1,www,z,z0,z1,gr1,gr2;
unsigned long time,oldPosition = -999,newPosition;
void setup() {
Serial.begin(9600);lcd.begin(16, 2);
irrecv.enableIRIn(); // запускаем модуль IR
pinMode(12,INPUT);// меню кнопка энкодера SW
pinMode(A0,INPUT);// кнопка POWER
pinMode(8,OUTPUT);// выход управления STANDBY
pinMode(A1,INPUT);// MUTE
digitalWrite(8,LOW);
lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);
vol = EEPROM.read(0);// vol eeprom
bass = EEPROM.read(1);// bass eeprom
treb = EEPROM.read(2);// treb eeprom
in = EEPROM.read(3);// in eeprom
balans = EEPROM.read(4)-4;// balans eeprom
lcd.setCursor(4,0);lcd.print("TDA8425");delay(1000);
MsTimer2::set(3, to_Timer);MsTimer2::start();
audio();
}
void loop() {delay(10);
if(standby==1){menu=100;lcd.setCursor(0,0);lcd.print(" POWER OFF ");}
if(analogRead(A0)>900&&standby==1){standby=0;lcd.clear();lcd.setCursor(0,0);lcd.print(" POWER ON ");digitalWrite(8,HIGH);delay(2000);menu=0;w2=1;}
if(analogRead(A0)>900&&standby==0){standby=1;lcd.clear();digitalWrite(8,LOW);delay(500);menu=100;}
if(analogRead(A1)>900&&mute==0&&standby==0){mute=1;cl();menu=100;lcd.setCursor(0,0);lcd.print(" MUTE ");delay(500);}
if(analogRead(A1)>900&&mute==1&&standby==0){mute=0;cl();delay(100);menu=0;w2=1;}
if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);time=millis();w=1;w2=1;irrecv.resume();}// IR приемник
if(digitalRead(12)==LOW&&standby==0){menu++;cl();myEnc.write(0);time=millis();w=1;w2=1;if(menu>4){menu=0;}}// меню
if(ir.value==0x2FDD02F&&standby==0){menu++;gr1=0;gr2=0;cl1();time=millis();w=1;w2=1;if(menu>4){menu=0;}}// IR меню кнопка вверх
if(ir.value==0x2FD32CD&&standby==0){menu--;gr1=0;gr2=0;cl1();time=millis();w=1;w2=1;if(menu<0){menu=4;}}// IR меню кнопка вниз
if(ir.value==0x2FD00FF&&standby==1){standby=0;gr1=0;gr2=0;cl();lcd.setCursor(0,0);lcd.print(" POWER ON ");digitalWrite(8,HIGH);delay(2000);menu=0;w2=1;}//IR power on
if(ir.value==0x2FD00FF&&standby==0){standby=1;gr1=0;gr2=0;cl();digitalWrite(8,LOW);delay(500);menu=100;}//IR power off
if(ir.value==0x2FD708F&&mute==0&&standby==0){mute=1;cl();menu=100;lcd.setCursor(0,0);lcd.print(" MUTE ");delay(500);}// IR MUTE
if(ir.value==0x2FD708F&&mute==1&&standby==0){mute=0;cl();menu=0;w2=1;}//IR MUTE
/////////////////////// VOLUME ///////////////////////////////////
if(menu==0){
if(ir.value==0x2FD906F){vol++;gr1=1;gr2=0;cl();w2=1;ogr_vol();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl();w2=1;ogr_vol();audio();}// кнопка >>>>>>
if(ir.value==0x2FDF20D){vol--;gr1=0;gr2=1;cl();w2=1;ogr_vol();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl();w2=1;ogr_vol();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
vol=vol+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;ogr_vol();audio();}
lcd.setCursor(0,0);lcd.print("VOLUME ");
lcd.print(" ");lcd.print((-60+vol)*2);lcd.print(" ");lcd.setCursor(13,0);lcd.print("dB");vol_d=vol-15;
if(w2==1){
for(z=0,z0=0,z1=0;z<=vol_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0,1);lcd.write((uint8_t)2);}w2=0;}}
//////////////// BASS /////////////////////////////////////
if(menu==1){
if(ir.value==0x2FD906F){bass++;gr1=1;gr2=0;cl();w2=1;ogr_bass();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl();w2=1;ogr_bass();audio();}// кнопка >>>>>>
if(ir.value==0x2FDF20D){bass--;gr1=0;gr2=1;cl();w2=1;ogr_bass();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl();w2=1;ogr_bass();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
bass=bass+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;ogr_bass();audio();}
lcd.setCursor(0,0);lcd.print("BASS ");
switch(bass){
case 11: bass_d=15;break;
case 10: bass_d=12;break;
case 9: bass_d=9;break;
case 8: bass_d=6;break;
case 7: bass_d=3;break;
case 6: bass_d=0;break;
case 5: bass_d=-3;break;
case 4: bass_d=-6;break;
case 3: bass_d=-9;break;
case 2: bass_d=-12;break;
}
if(bass_d>=0){lcd.print("+");}else{lcd.print("-");}
if(bass_d>-10&&bass_d<=0||bass_d<10&&bass_d>0){{lcd.print(" ");}}
lcd.print(abs(bass_d));lcd.print(" dB ");
if(w2==1){bass_d=bass_d+12;
for(z=0,z0=0,z1=0;z<=bass_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+3+1,1);lcd.print(" ");}}
if(bass_d==0){lcd.setCursor(0,1);lcd.print(" ");}w2=0;}}
/////////////////////// TREBLE //////////////////////////////////////////////////////
if(menu==2){
if(ir.value==0x2FD906F){treb++;gr1=1;gr2=0;cl();w2=1;ogr_treb();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl();w2=1;ogr_treb();audio();}// кнопка >>>>>>
if(ir.value==0x2FDF20D){treb--;gr1=0;gr2=1;cl();w2=1;ogr_treb();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl();w2=1;ogr_treb();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
treb=treb+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;ogr_treb();audio();}
lcd.setCursor(0,0);lcd.print("TREBLE ");
switch(treb){
case 10: treb_d=12;break;
case 9: treb_d=9;break;
case 8: treb_d=6;break;
case 7: treb_d=3;break;
case 6: treb_d=0;break;
case 5: treb_d=-3;break;
case 4: treb_d=-6;break;
case 3: treb_d=-9;break;
case 2: treb_d=-12;break;
}
if(treb_d>=0){lcd.print("+");}else{lcd.print("-");}
if(treb_d>-10&&treb_d<=0||treb_d<10&&treb_d>0){{lcd.print(" ");}}
lcd.print(abs(treb_d));lcd.print(" dB ");
if(w2==1){treb_d=treb_d+12;
for(z=0,z0=0,z1=0;z<=treb_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+4,1);lcd.write((uint8_t)0);lcd.setCursor(z0+4+1,1);lcd.print(" ");}}
if(treb_d==0){lcd.setCursor(0,1);lcd.print(" ");}w2=0;}}
//////////////// BALANCE /////////////////////////////////////
if(menu==3){
if(ir.value==0x2FD906F){balans++;gr1=1;gr2=0;cl();w2=1;ogr_balans();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){balans++;gr2=0;cl();w2=1;ogr_balans();audio();}// кнопка >>>>>>
if(ir.value==0x2FDF20D){balans--;gr1=0;gr2=1;cl();w2=1;ogr_balans();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){balans--;gr1=0;cl();w2=1;ogr_balans();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
balans=balans+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;lcd.clear();ogr_balans();audio();}
lcd.setCursor(0,0);
if(balans*2>=0){lcd.print("-");}else{lcd.print("+");}
lcd.print(abs(balans*2));lcd.print(" dB ");
lcd.print(" <> ");
if(balans*2>=0){lcd.print("+");}else{lcd.print("-");}
lcd.print(abs(balans*2));lcd.print(" dB ");
lcd.setCursor(0,1);lcd.print("L");
lcd.setCursor(15,1);lcd.print("R");
if(balans<0){lcd.setCursor(balans+7,1);lcd.write((uint8_t)0);}
if(balans>0){lcd.setCursor(balans+8,1);lcd.write((uint8_t)0);}
if(balans==0){lcd.setCursor(7,1);lcd.write((uint8_t)0);lcd.setCursor(8,1);lcd.write((uint8_t)0);}}
///////////////////////// input /////////////////////////////
if(menu==4){
if(ir.value==0x2FD906F){in++;gr1=1;gr2=0;cl1();w2=1;ogr_in();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){in++;gr2=0;cl1();w2=1;ogr_in();audio();}// кнопка >>>>>>
if(ir.value==0x2FDF20D){in--;gr1=0;gr2=1;cl1();w2=1;ogr_in();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){in--;gr1=0;cl1();w2=1;ogr_in();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
in=in+newPosition;myEnc.write(0);newPosition=0;audio();lcd.clear();time=millis();w=1;ogr_in();audio();}
lcd.setCursor(0,0);lcd.print("Source selector");
lcd.setCursor(0,1);lcd.print("INPUT: ");lcd.print(in);
}
////////////////////////////////////////////////////////////////
if(millis()-time>10000 && w==1){// сохранение всех настроек в eeprom через 10 сек неактивности
EEPROM.update(0,vol);
EEPROM.update(4,balans+4);
EEPROM.update(1,bass);
EEPROM.update(2,treb);
EEPROM.update(3,in);
w=0;w2=1;menu=0;cl(); }
}//loop
void ogr_in(){if(in>1){in=0;}if(in<0){in=1;}}
void ogr_balans(){if(balans>4){balans=4;}if(balans<-4){balans=-4;}}
void ogr_treb(){if(treb>10){treb=10;}if(treb<2){treb=2;}}
void ogr_bass(){if(bass>11){bass=11;}if(bass<2){bass=2;}}
void ogr_vol(){if(vol<0){vol=0;}if(vol>63){vol=63;}}
void cl(){ir.value=0;delay(200);lcd.clear();}
void cl1(){ir.value=0;delay(400);lcd.clear();}
void to_Timer(){newPosition = myEnc.read()/4;}
void audio(){
tda.setVolumeL(vol+balans);
tda.setVolumeR(vol-balans);
tda.setBass(bass);
tda.setTreble(treb);
tda.setMute(mute);
tda.setSource(in);