声控车
组件和用品
| × | 1 | ||||
| × | 1 | ||||
| × | 2 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 |
关于这个项目
组件:
- Arduino Uno
- 面包板
- 电机 x2
- 轮子 x2
- 机箱(大小合适)
- 电压调节器 LM7805
- L293D
- 12V 电池(电源)
- 跳线
- 蓝牙模块 HC-05
您可以在此处找到该应用程序:https://play.google.com/store/apps/details?id=appinventor.ai_cempehlivan92.Arduino_Sesli_Kontrol
想法:
我们将蓝牙模块与移动应用程序连接。完成后,我们通过移动设备发出的命令将通过模块发送到 Arduino。我们从应用程序发送的串行缓冲区中逐个字符地接受并将它们组合成一个字符串。
然后我们将其与命令进行比较。如果匹配,则执行该命令。例如,当我们收到的字符串是“Right”时,机器人向右转。
连接:
在此处查找所有连接:https://yainnoware.blogspot.com/p/voice-controlled-car.html
代码:
int motor_input1=11;int motor_input2=10;int motor_input3=5;int motor_input4=6;String voice;void setup() { Serial.begin(9600); pinMode(电机输入1,输出); //右马达 pinMode(motor_input2, OUTPUT); //右电机 pinMode(motor_input3, OUTPUT); //左电机 pinMode(motor_input4, OUTPUT); //LEFT MOTOR}void loop() { while(Serial.available()>0) { delay(10); char c=Serial.read(); if(c=='#') { break; } 语音+=c; } if(voice=="forward"){ digitalWrite(motor_input1, LOW);数字写入(电机输入2,高);数字写入(电机输入3,低);数字写入(电机输入4,高);延迟(5000); } else if(voice=="back"){ digitalWrite(motor_input1, HIGH);数字写入(电机输入2,低);数字写入(电机输入3,高);数字写入(电机输入4,低); delay(5000);} else if(voice=="left"){ digitalWrite(motor_input1, LOW);数字写入(电机输入2,高);数字写入(电机输入3,高);数字写入(电机输入4,低);延迟(800); } else if(voice=="right"){ digitalWrite(motor_input1, HIGH);数字写入(电机输入2,低);数字写入(电机输入3,低);数字写入(电机输入4,高);延迟(800); } if(voice.length()>0) 则声音="";数字写入(电机输入1,低);数字写入(电机输入2,低);数字写入(电机输入3,低);数字写入(电机输入4,低); } }
制造工艺