easy vr and cube servo, problem

Hello everyone, can you guys find the problem here

[code]
#include <SoftwareSerial.h>
#include "Arduino.h"
#include "EasyVR.h"
#include <Cytron_G15Shield.h>
#if !defined(SERIAL_PORT_MONITOR)
#error "Arduino version not supported. Please update your IDE to the latest version."
#endif

#if defined(__SAMD21G18A__)
// Shield Jumper on HW (for Zero, use Programming Port)
#define port SERIAL_PORT_HARDWARE
#define pcSerial SERIAL_PORT_MONITOR
#elif defined(SERIAL_PORT_USBVIRTUAL)
// Shield Jumper on HW (for Leonardo and Due, use Native Port)
#define port SERIAL_PORT_HARDWARE
#define pcSerial SERIAL_PORT_USBVIRTUAL
#else
Cytron_G15Shield g15(2, 3, 8); // SoftwareSerial: Rx, Tx and Control pin
//Cytron_G15Shield g15(8); // HardwareSerial: Control pin
// Shield Jumper on SW (using pins 12/13 or 8/9 as RX/TX)
SoftwareSerial port(12, 13);
#define pcSerial SERIAL_PORT_MONITOR
#endif

#define G15_1 1
#define G15_2 2
#define LED 13

EasyVR easyvr(port);

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

enum Group0
{
  G0_ROBOT_HAND = 0,
};

enum Group1
{
  G1_ROTATE_0 = 0,
  G1_ROTATE_45 = 1,
  G1_ROTATE_90 = 2,
  G1_ROTATE_135 = 3,
  G1_ROTATE_180 = 4,
  G1_ROTATE_225 = 5,
  G1_ROTATE_270 = 6,
  G1_ROTATE_315 = 7,
  G1_ROTATE_360 = 8,
  G1_ROTATE_2 = 9,
  G1_ROTATE_3 = 10,
  G1_ROTATE_4 = 11,
  G1_HAND_GRIP = 12,
  G1_HAND_OPEN = 13,
  G1_HAND_HALFOPEN = 14,
  G1_HAND_CRUSH = 15,
};

// use negative group for wordsets
int8_t group, idx;

void setup()
{
  g15.begin(19200);

  // Make sure G15 in position mode
  g15.exitWheelMode(G15_1);
  g15.exitWheelMode(G15_2);
  
  // setup PC serial port
  pcSerial.begin(9600);
bridge:
  // bridge mode?
  int mode = easyvr.bridgeRequested(pcSerial);
  switch (mode)
  {
    case EasyVR::BRIDGE_NONE:
      // setup EasyVR serial port
      port.begin(9600);
      // run normally
      pcSerial.println(F("Bridge not requested, run normally"));
      pcSerial.println(F("---"));
      break;

    case EasyVR::BRIDGE_NORMAL:
      // setup EasyVR serial port (low speed)
      port.begin(9600);
      // soft-connect the two serial ports (PC and EasyVR)
      easyvr.bridgeLoop(pcSerial);
      // resume normally if aborted
      pcSerial.println(F("Bridge connection aborted"));
      pcSerial.println(F("---"));
      break;

    case EasyVR::BRIDGE_BOOT:
      // setup EasyVR serial port (high speed)
      port.begin(115200);
      pcSerial.end();
      pcSerial.begin(115200);
      // soft-connect the two serial ports (PC and EasyVR)
      easyvr.bridgeLoop(pcSerial);
      // resume normally if aborted
      pcSerial.println(F("Bridge connection aborted"));
      pcSerial.println(F("---"));
      break;
  }

  // initialize EasyVR
  while (!easyvr.detect())
  {
    pcSerial.println(F("EasyVR not detected!"));
    for (int i = 0; i < 10; ++i)
    {
      if (pcSerial.read() == '?')
        goto bridge;
      delay(100);
    }
  }

  pcSerial.print(F("EasyVR detected, version "));
  pcSerial.print(easyvr.getID());

  if (easyvr.getID() < EasyVR::EASYVR3)
    easyvr.setPinOutput(EasyVR::IO1, LOW); // Shield 2.0 LED off

  if (easyvr.getID() < EasyVR::EASYVR)
    pcSerial.print(F(" = VRbot module"));
  else if (easyvr.getID() < EasyVR::EASYVR2)
    pcSerial.print(F(" = EasyVR module"));
  else if (easyvr.getID() < EasyVR::EASYVR3)
    pcSerial.print(F(" = EasyVR 2 module"));
  else
    pcSerial.print(F(" = EasyVR 3 module"));
  pcSerial.print(F(", FW Rev."));
  pcSerial.println(easyvr.getID() & 7);

  easyvr.setDelay(0); // speed-up replies

  easyvr.setTimeout(5);
  easyvr.setLanguage(0); //<-- same language set on EasyVR Commander when code was generated

  group = 1;

}

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

  if (group < 0) // SI wordset/grammar
  {
    pcSerial.print("Say a word in Wordset ");
    pcSerial.println(-group);
    easyvr.recognizeWord(-group);
  }
  else // SD group
  {
    pcSerial.print("Say a command in Group ");
    pcSerial.print(" AAA ");
    pcSerial.println(group);
    easyvr.recognizeCommand(group);
  }

  do
  {
    // allows Commander to request bridge on Zero (may interfere with user protocol)
    if (pcSerial.read() == '?')
    {
      setup();
      return;
    }
    // <<-- can do some processing here, while the module is busy
  }
  while (!easyvr.hasFinished());

  if (easyvr.getID() < EasyVR::EASYVR3)
    easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  idx = easyvr.getWord();
  if (idx == 0 && group == EasyVR::TRIGGER)
  {
    // beep
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // print debug message
    pcSerial.println("Word: ROBOT");
    // write your action code here
    // group = GROUP_X\SET_X; <-- jump to another group or wordset
    return;
  }
  else if (idx >= 0)
  {
    // beep
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // print debug message
    uint8_t flags = 0, num = 0;
    char name[32];
    pcSerial.print("Word: ");
    pcSerial.print(idx);
    if (easyvr.dumpGrammar(-group, flags, num))
    {
      for (uint8_t pos = 0; pos < num; ++pos)
      {
        if (!easyvr.getNextWordLabel(name))
          break;
        if (pos != idx)
          continue;
        pcSerial.print(F(" = "));
        pcSerial.println(name);
        break;
      }
    }
    // perform some action
    action();
    return;
  }
  idx = easyvr.getCommand();
  if (idx >= 0)
  {
    // beep
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // print debug message
    uint8_t train = 0;
    char name[32];
    pcSerial.print("Command: ");
    pcSerial.print(idx);
    if (easyvr.dumpCommand(group, idx, name, train))
    {
      pcSerial.print(" = ");
      pcSerial.println(name);
    }
    else
      pcSerial.println();
    // perform some action
    action();
  }
  else // errors or timeout
  {
    if (easyvr.isTimeout())//timeout()=1 masuk sini
      pcSerial.println("Timed out, try again...");
      Serial.println(easyvr.isTimeout());
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      pcSerial.print("Error ");
      pcSerial.println(err, HEX);
      
    }
  }
}

void action()
{
  switch (group)
  {
    case GROUP_1:
      switch (idx)
      {
        case G1_ROTATE_0:
          // write your action code here
          Serial.println("0deg");
          g15.setLED(G15_1, ON);
          g15.setSpeed(G15_1, 500); // Set G15 (ID = 1) speed to 500, 
          g15.setPosAngle(G15_1, 0); // Set G15 (ID = 1) position to 0 deg
          delay(100);
          Serial.println(easyvr.isTimeout());
          //Serial.print(err);
          // group = GROUP_X\SET_X; <-- or jump to another group or wordset for composite commands
         
          break;
        case G1_ROTATE_45:
          // write your action code here
          Serial.print("45deg");
          g15.setLED(G15_1, ON);
          g15.setSpeed(G15_1, 500); // Set G15 (ID = 1) speed to 500, 
          g15.setPosAngle(G15_1, 45); // Set G15 (ID = 1) position to 0 deg
          
          // group = GROUP_X\SET_X; <-- or jump to another group or wordset for composite commands
          break;
      }
      break;
  }
}

[/code]

the servo only work once, then when to say a new command , serial monitor freeze

which line that i need to insert g15.begin(19200); in the void setup.

can you guys find the problem here

Without knowing what the code actually does? Without knowing what you expect? Without knowing what hardware it is running on? Without knowing what hardware is connected? Without knowing how that hardware is configured? Doesn't seem likely.

It looks to me like you are using two SoftwareSerial instances. That rarely works.

the servo only work once, then when to say a new command , serial monitor freeze

The Serial Monitor application only reacts when the Arduino sends serial data. If the Serial Monitor stops reacting, you can be certain that the problem is that the Arduino stopped sending data.

The first thing to do is comment out the code to move the servo. Just Serial.print() that you would move the servo. Does that allow the Arduino to continue running?

The second thing to do is read up on SoftwareSerial. Learn what happens when you send data using one instance of SoftwareSerial. In particular, pay attention to what that causes the other instances to do. There is a remedy. If you don't find it, listen() up.