I have created one app and tried ~ 3 apps on this site/Youtube to give command to this project (https://www.instructables.com/Bluetooth-Voice-Controlled-Moving-Lamp/) and none of it can give the commands.
Whereas the BT Voice Control for Arduino app that I downloaded on CH Play can give all the commands just fine.
Any idea guys? I will attach the .aia files below. Thank you!
i-created.aia (48.6 KB)
This might help in your AI2 blocks, to avoid sending when BlueTooth is not connected.
Other considerations:
Is your expected text case sensitive? Are you expecting "Yes" but sending "yes" ?
Your language has extended characters in it. How well does the Speech recognizer generate them?
Your Arduino code that processes the text would be nice to post.
Thank you for your reply.
My expected text is not case sensitive. In this project I still use English as the language for Speech recognizer (I tried my native language with the CH play app and it still worked fine tho).
Here is the Arduino codeArduino.txt (4.2 KB)
I tried your additions but it still doesn't work unfortunately
What does the * in front of each of your commands mean to this coding language?
Is it meant to be part of the literal text, or is it a language thing?
I don't expect it to be generated from a Speech to Text process.
Likewise the # character.
#include <Servo.h>
String command;
String value;
//Dat ten servo
Servo servo_rotation;
Servo servo_tilt;
Servo servo_height;
int step_delay = 30;
void setup() {
Serial.begin(9600);
servo_rotation.attach(3);
servo_tilt.attach(5);
servo_height.attach(6);
servo_rotation.write(90);
servo_tilt.write(90);
servo_height.write(100);
//RELAY
pinMode(7, OUTPUT);
digitalWrite(7, LOW);
}
void loop() {
while (Serial.available())
{
delay(10);
char command_char = Serial.read();
if (command_char == '#')
{break;}
command += command_char;
}
if (command.length() > 0)
{
Serial.println(command);
if(command.indexOf("*counterclockwise") >= 0)
{
value = command.substring(17, command.length());
for(int a = 0; a < value.toInt(); a++){
if((servo_rotation.read()+1) >= 0 && (servo_rotation.read()+1) <= 180)
{
servo_rotation.write(servo_rotation.read()+1);
delay(step_delay);
}
}
}
if(command.indexOf("*counter clockwise") >= 0)
{
value = command.substring(18, command.length());
for(int a = 0; a < value.toInt(); a++)
{
if((servo_rotation.read()+1) >= 0 && (servo_rotation.read()+1) <= 180)
{
servo_rotation.write(servo_rotation.read()+1);
delay(step_delay);
}
}
}
if(command.indexOf("*clockwise") >= 0)
{
value = command.substring(10, command.length());
for(int a = 0; a < value.toInt(); a++)
{
if((servo_rotation.read()-1) >= 0 && (servo_rotation.read()-1) <= 180)
{
servo_rotation.write(servo_rotation.read()-1);
delay(step_delay);
}
}
}
if(command.indexOf("*front") >= 0)
{
value = command.substring(7, command.length());
for(int a = 0; a < value.toInt(); a++){
if((servo_tilt.read()+1) < 140 && (servo_tilt.read()+1) > 50)
{
servo_tilt.write(servo_tilt.read()+1);
}
if((servo_height.read()-1) < 150 && (servo_height.read()-1) >= 0)
{
servo_height.write(servo_height.read()-1);
}
delay(step_delay);
}
}
if(command.indexOf("*back") >= 0)
{
value = command.substring(5, command.length());
for(int a = 0; a < value.toInt(); a++){
if((servo_tilt.read()-1) < 140 && (servo_tilt.read()-1) > 50)
{
servo_tilt.write(servo_tilt.read()-1);
}
if((servo_height.read()+1) < 150 && (servo_height.read()+1) >= 0)
{
servo_height.write(servo_height.read()+1);
}
delay(step_delay);
}
}
if(command.indexOf("*up") >= 0)
{
value = command.substring(3, command.length());
for(int a = 0; a < value.toInt(); a++)
{
if((servo_height.read()-1) < 150 && (servo_height.read()-1) >= 0)
{
servo_height.write(servo_height.read()-1);
delay(step_delay);
}
}
}
if(command.indexOf("*down") >= 0)
{
value = command.substring(5, command.length());
for(int a = 0; a < value.toInt(); a++)
{
if((servo_height.read()+1) < 150 && (servo_height.read()+1) >= 0)
{
servo_height.write(servo_height.read()+1);
delay(step_delay);
}
}
}
if(command.equals("*on"))
{
digitalWrite(7, HIGH);
}
if(command.equals("*off"))
{
digitalWrite(7, LOW);
}
}
command="";
}
Well it was part of the source code that I found on the website I linked in the first page, I guess the * counts as a number of substring perhaps? Anyway removing * seems to fix my problems, thanks!