6874| 3
|
[求助] !<(SKU:DFR0189)ASR Board for Arduino语音识别控制器>程序老报错!! |
买回来的ASRBoard怎么搞都搞不好 我先把asr_board_init.ino烧了一遍,结果烧完只有ON和Start亮着,D8和D13怎么弄都没反应,烧后面的程序也烧不上去 #include <EEPROM.h> byte value; void setup() { Serial.begin(9600); while (!Serial) { ; } } void loop() { for (int i = 0; i < 512; i++) EEPROM.write(i, 0); delay(50); EEPROM.write(2,78); EEPROM.write(5, 3); delay(50); value = EEPROM.read(2); Serial.print(value); Serial.print("\t"); value = EEPROM.read(5); Serial.println(value); while(1); } 我是按DF官方的步骤来,先找了张1G的卡,把AD4文件考上去,然后烧初始化的程序,但是烧完就没反应了,我接着上ASRBled.ino,结果这个程序报错,说是少了头文件WConstants.h #include <ASRB.h> #include <EEPROM.h> #include <SPI.h> #define SUM 35// int set=0,vall,res; char sRecog[SUM][38]={"kai deng","guan deng","zhun bei"};// unsigned int fDigit[SUM]={252,253,254};//AD4 void BT(int x,int y,char (*p)[38],unsigned int dd[],int set); void PT(int x,int y,char (*p)[38],unsigned int dd[],int set); void ASR_while(int x,int y,char (*p)[38],unsigned int dd[],int set); void ASR_BT(int x,int y,char (*p)[38],unsigned int dd[],int set); int button=3,led=4; void setup() { ASRB.Initialise(SUM,sRecog,fDigit); attachInterrupt(0,ExtInt0Handler,LOW); //pinMode(button,INPUT); pinMode(led,OUTPUT); digitalWrite(led,HIGH); } void loop() { if(vall==111) PT(SUM,38,sRecog,fDigit,set); // else if(vall==112) BT(SUM,38,sRecog,fDigit,set); // else { while(1) { res=0; res=ASRB.Asr(SUM,38,sRecog,fDigit,set); ASR_monitor(); delay(10); ASRB.Busy_SD(); if (Serial.available() > 0) break; } } // ASRB.AT_command(SUM,38,sRecog,fDigit,set);// delay(100); } void ExtInt0Handler () { ASRB.ProcessInt0(); } void ASR_while(int x,int y,char (*p)[38],unsigned int dd[],int set) { while(1) { res=0; res=ASRB.Asr(x,y,p,dd,set); ASR_monitor(); delay(10); ASRB.Busy_SD(); if(res<255&&res>0) break; if (Serial.available() > 0) break; // else if(digitalRead(button)==LOW) break; } } void ASR_BT(int x,int y,char (*p)[38],unsigned int dd[],int set) { ASRB.send_SD(260); delay(50); ASRB.Busy_SD(); ASR_while(x,y,p,dd,set); } /**************************************语音控制LED****************************/ void ASR_monitor() { if(res==252) digitalWrite(led,LOW); else if(res==253) digitalWrite(led,HIGH); } /*******************************口令模式*************************************/ void PT(int x,int y,char (*p)[38],unsigned int dd[],int set) { while(1) { set=1; if (Serial.available() > 0) { set=0; break; } int h=ASRB.Asr(x,y,p,dd,set); delay(50); if(h==254) // { set=0; ASRB.send_SD(260); delay(50); ASRB.Busy_SD(); ASR_while(x,y,p,dd,set); } } } /*******************************按键模式**************************************/ void BT(int x,int y,char (*p)[38],unsigned int dd[],int set) { char local[10]={0}; char DD[1][6]={"asrbt"}; while(1) { if (Serial.available() > 0) { local[0]= Serial.read(); delay(20); if(local[0]!=0x41) { for(int i=1;i<8;i++) { local= Serial.read(); if( local==0x0a) // { if( local[i-1]==0x0d) { local=0; local[i-1]=0; if(strcmp(local,DD[0])==0) //AT { ASR_BT(x,y,p,dd,set); break; } } } } } else break; } /* else if(digitalRead(button)==LOW) { delay(100); if(digitalRead(button)==LOW) { ASR_BT(x,y,p,dd,set); break; } }*/ } } 我就想问问是程序有问题还是我的做法不对? 望知道的朋友帮帮忙:handshake |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed