New Homepage Forums Special Shields voice recognition

This topic contains 3 replies, has 3 voices, and was last updated by avatar Amr 2 years, 5 months ago. This post has been viewed 408 times

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #72703

    I am seeking help with the following problem. my program beings and I hit “tap to speak”. I give the first command and based on this command the program then enters the respective function associated with that command. while in this function I would like to access the voice recognition sheeld to enter a parameter associated with the first vocal command. help me.

    avatarAhmed ismail

    Hey, you can easily do that by automatically activating the voice recognition shield through this command: VoiceRecognition.start();

    And then you can make a 5 sec delay through this line: OneSheeld.delay(5000); then you can check the latest received voice command.

    Please let me know if you need any help with the code 😉


    i am building an “car” that uses the Ultra sonic senor to measure distances and then use that distance and the distance commanded by the user to determine how far the car should move. here is a copy of the function containing the problem i would like to solve. I would like the flow of the program to go as follows:
    1. measure the initial distance from the car to an object.
    2. ask what direction the user wants the car to move
    3. once direction is commanded (forward, reverse, left, or right) the program enter the function below

    in this function I would like the program to display the commanded direction, and ask the user how far the car should travel.
    this is where I am stuck :{
    I am having trouble with looping the program here to “wait” for the user to input the required distance.
    the user should be able to hit the talk button and say the required distance that it want the car to travel.
    the program should then take this required distance subtract it from the original measured distance and calculate a new “original distance”.
    once this new “original distance” is calculated, the program leaves this function and enter another function that activates the motors in respect to the initial direction given by the user.
    at this point the car is moving in the requested direction (lets say toward the object). i would like the car to take measurements as it is moving towards the object, and with each measurement compare it to the new “original distance”, and once the moving measurement is equal to new “original distance” the car should halt. and reinitialize the entire program over again.

    void Cent_Request(String command){

    received_cent_len = VoiceRecognition.getLastCommand(); //the voice command (distance to travel) is store in a character array

    void Request_len(){ //name of the function

    String cent_len = “”;

    do {
    lcd.print(received_direction); //display the commanded direction
    lcd.print(“How many cm?”); //request from user how far to travel

    cent_len = received_cent_len; //store the commanded distance to travel as as a string
    cm_to_travel = cent_len.toInt(); //store the string as an integer
    newDistance = distance – cm_to_travel; //calculate the new “original distance” (original distance – distance to travel)
    int distance_to_travel = newDistance; //store newDistance in a local variable

    lcd.print(newDistance); //display new “original distance”
    lcd.print(distance); //display the initial original distance
    lcd.print(cm_to_travel); //display the distance the car should move
    lcd.print(distance_to_travel); //display the new “original distance” again
    while (cm_to_travel <= 0); //loop here in the function until the user command how far the car should move

    static int distance_to_travel = newDistance; //maintain the calculated new “original distance
    value = distance_to_travel; //the maintain new “original distance” is stored as a value to be compared to the now moving car measured distances.
    so my 3 issues are:
    1. unable to loop to function until the user tap the talk button and command how far the car should move
    2. maintaining the calculate new “original distance” so that it does not change while the car is moving, because it is needed to be compared to the distances being measured as the car moves
    3.keep the car moving (motors activate) until the new “original distance” and the distances being measured as the car moves have become equal.

    I hope this information was helpful in assisting me in finding a solution. thank you in advance



    Can you please post full code so I can check your issues …

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.