Arduino Voice Control APP
Arduino的示例代码(Arduino的示例代码):
ReadString字符串= “”;
的#define LED 13 //
空隙设置(){
在pinmo(LED,OUTPUT);
digitalwrit(发光二极管,LOW);
Serial.beg的(9600);
}
空隙环(){
而(Serial.availabl A()){
炭C =(char)的Serial.read();
ReadString + = C;
}
如果(readstring.length()> 0){
如果(ReadString == “打开”){
digitalwrit(发光二极管,HIGH);
Serial.print( “打开”);
}
否则,如果(ReadString == “关”){
digitalwrit(发光二极管,LOW);
Serial.print( “关闭”);
}
否则,如果(ReadString ==“非常几间房子”){
//度计算处理等。
Serial.print( “家现在21度”);
}
否则,如果(ReadString == “讲英语”){
Serial.print( “嗨,你怎么样?”);
}
否则{
Serial.print(“我不明白你。”);
}
ReadString = “”;
}
延迟(100);
}