Arduino+EasyVR : a little help in programming

hey,
i am using arduino with EasyVR for one of my college projects. I am working over it from weeks, so i know basics of EasyVR
But there’s a little a little problem, which i am not able to overcome.
In particular its not a problem,
Actually can anybody tell me how can i make a particular command/action keep on executing until a new command is heard. for example, i spoke LED_BLINK, and i want that LED keeps on blinking until a new command for different group is heard !!
i am using EasyVr commander 3.6.22 for training commands and generating .pde(arduino ) code !

here’s code

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #include "SoftwareSerial.h"
  SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
  #include "WProgram.h"
  #include "NewSoftSerial.h"
  NewSoftSerial port(12,13);
#endif

#include "EasyVR.h"
EasyVR easyvr(port);

//Groups and Commands
enum Groups
{
  GROUP_0  = 0,
  GROUP_1  = 1,
};

enum Group0 
{
  G0_START = 0,
};

enum Group1 
{
  G1_LED_BLINK = 0,
};


EasyVRBridge bridge;

int8_t group, idx;

void setup()
{
  // bridge mode?
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
  // run normally
  Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(0);

  group = EasyVR::TRIGGER; //<-- start group (customize)
}

void action();

void loop()
{
  easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

  Serial.print("Say a command in Group ");
  Serial.println(group);
  easyvr.recognizeCommand(group);

  do
  {
    
    //Serial.println("can do some processing while waiting for a spoken command");
  }
  while (!easyvr.hasFinished());
  
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  idx = easyvr.getWord();
  if (idx >= 0)
  {
    Serial.print("built in triggr, robot");
    // built-in trigger (ROBOT)
    // group = GROUP_X; <-- jump to another group X
    return;
  }
  idx = easyvr.getCommand();
  if (idx >= 0)
  {
    // print debug message
    uint8_t train = 0;
    char name[32];
    Serial.print("Command: ");
    Serial.print(idx);
    if (easyvr.dumpCommand(group, idx, name, train))
    {
      Serial.print(" = ");
      Serial.println(name);
    }
    else
      Serial.println();
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // perform some action
    action();
  }
  else // errors or timeout
  {
    if (easyvr.isTimeout())
      Serial.println("Timed out, try again...");
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      Serial.print("Error ");
      Serial.println(err, HEX);
    }
  }
}

void action()
{
    switch (group)
    {
    case GROUP_0:
      switch (idx)
      {
      case G0_START:
        // write your action code here
        group=GROUP_1;              // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    case GROUP_1:
      switch (idx)
      {
      case G1_LED_BLINK:
     
      digitalWrite(13,HIGH);
      delay(150);
      digitalWrite(13,LOW);
      delay(150); 
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    }
}

thank you !!

In your loop you have the code:

  do
  {
    
    //Serial.println("can do some processing while waiting for a spoken command");
  }
  while (!easyvr.hasFinished());

You just need to add something there to check if a previous command has completed and if not, reissue the command.

Another strategy would be to reorganize your loop so that on entry it checks for a complete VR command and if present handles it. Otherwise it checks for the completion of the previous VR command response and if complete, re-initiates it.

With programming that responds to external events it is never a good idea to have a loop like the one I copied as it does not allow the S/W to deal with anything else until the loop’s exit condition is met. Much better to enter loop(), check and respond to all conditions and then exit. The Arduino S/W will repeat the loop. You need not do that in your code.

HTH