学前班
最后登录1970-1-1
在线时间 小时
注册时间2018-7-21
|
[mw_shl_code=c,true]void LD3320_main(void)
{
float temperature = 0;
float humidity = 0;
uint8 nAsrRes=0;
LD3320_init();
SystemInit();
usart_Configuration();
NVIC_Configuration();
delay_ms(1000);
delay_ms(1000);
while(DHT22_Init());
DHT22_Read_Data(&temperature,&humidity);
nAsrStatus = LD_ASR_NONE;//初始状态:没有在作ASR
while(1)
{
delay_ms(1000);
delay_ms(1000);
DHT22_Read_Data(&temperature,&humidity);
printf("\r\ntemperature = %.2f\r\n",temperature);
printf("humidity = %.2f\r\n",humidity);
switch(nAsrStatus)
{
case LD_ASR_RUNING:
case LD_ASR_ERROR:
break;
case LD_ASR_NONE:
nAsrStatus=LD_ASR_RUNING;
if (RunASR()==0)//启动一次ASR识别流程:ASR初始化,ASR添加关键词语,启动ASR运算
{
nAsrStatus = LD_ASR_ERROR;
}
break;
case LD_ASR_FOUNDOK:
nAsrRes = LD_GetResult( );//一次ASR识别流程结束,去取ASR识别结果
switch(nAsrRes) //对结果执行相关操作,客户修改
{
case CODE_QD: //命令“启动风扇”
Usart_SendByte( TEST_USART, 'A');
break;
case CODE_JS: //命令“加快速度”
Usart_SendByte( TEST_USART, 'B');
break;
case CODE_J1S: //命令“减少速度”
Usart_SendByte( TEST_USART, 'C');
break;
case CODE_FZ: //命令“反向转动”
Usart_SendByte( TEST_USART, 'D');
break;
case CODE_GB: //命令“关闭风扇”
Usart_SendByte( TEST_USART, 'E');
default:break;
}
nAsrStatus = LD_ASR_NONE;
break;
case LD_ASR_FOUNDZERO:
default:
nAsrStatus = LD_ASR_NONE;
break;
}//switch
Board_text(nAsrRes );
}// while
}[/mw_shl_code]
|
|