“MAi.waitResult()”的版本间的差异
502748957@qq.com(讨论 | 贡献) (创建页面,内容为“1”) |
502748957@qq.com(讨论 | 贡献) |
||
| (未显示同一用户的1个中间版本) | |||
| 第1行: | 第1行: | ||
| − | + | {| style="width: 800px;" | |
| + | |- | ||
| + | | | ||
| + | <p style="color: #666666;font-size:220%">'''mAi.waitResult(char* res)'''</p> | ||
| + | <br> | ||
| + | <p style="color: #E87E05;font-size:135%">描述</p> | ||
| + | waitResult()函数用于等待语音识别结果 | ||
| + | <br> | ||
| + | 需要调用<code style="color: #E87E05">#include <Microduino_Ai.h></code>头文件。 | ||
| + | <br> | ||
| + | <p style="color: #E87E05;font-size:135%">参数</p> | ||
| + | *char* res:字符串,用于接收识别结果,识别出来的结果可返回汉字 | ||
| + | <p style="color: #E87E05;font-size:135%">实例</p> | ||
| + | 启动语音识别后,使用该函数等待获取结果 | ||
| + | <source lang="cpp"> | ||
| + | if(touch2.readEvent() == SHORT_PRESS) { | ||
| + | delay(500); | ||
| + | Serial.print("AT start Rest: "); | ||
| + | if(mAi.startRest()){ | ||
| + | Serial.println("OK!"); | ||
| + | int32_t code = mAi.waitResult(strBuf); | ||
| + | if(code){ | ||
| + | Serial.print("rest code: "); | ||
| + | Serial.print(code); | ||
| + | Serial.print(", result: "); | ||
| + | Serial.println(strBuf); | ||
| + | }else{ | ||
| + | Serial.println("rest none "); | ||
| + | } | ||
| + | }else{ | ||
| + | Serial.println("Failed!"); | ||
| + | } | ||
| + | </source> | ||
| + | |} | ||
| + | <br> | ||
| + | <br> | ||
| + | <p style="font-size:115%">[[MicroAI Reference|返回MicroAI编程手册]]</p> | ||
2018年12月24日 (一) 05:50的最新版本
|
mAi.waitResult(char* res)
描述 waitResult()函数用于等待语音识别结果
参数
实例 启动语音识别后,使用该函数等待获取结果 if(touch2.readEvent() == SHORT_PRESS) {
delay(500);
Serial.print("AT start Rest: ");
if(mAi.startRest()){
Serial.println("OK!");
int32_t code = mAi.waitResult(strBuf);
if(code){
Serial.print("rest code: ");
Serial.print(code);
Serial.print(", result: ");
Serial.println(strBuf);
}else{
Serial.println("rest none ");
}
}else{
Serial.println("Failed!");
}
|