Easy VR Shield 3 HELP!


hello. need project 'm doing vr , arduino easy . when compiling code , open serial monitor get: "easy vr not detected "
help take lot of time researching can not find answer.
thank's
(i'm using google translate)
code: [select]

#include "arduino.h"
#if !defined(serial_port_monitor)
  #error "arduino version not supported. please update ide latest version."
#endif

#if defined(serial_port_usbvirtual)
  // shield jumper on hw (for leonardo , due)
  #define port serial_port_hardware
  #define pcserial serial_port_usbvirtual
#else
  // shield jumper on sw (using pins 12/13 or 8/9 rx/tx)
  #include "softwareserial.h"
  softwareserial port(12, 13);
  #define pcserial serial_port_monitor
#endif

#include "easyvr.h"

easyvr easyvr(port);

//groups , commands
enum groups
{
  group_1  = 1,
  group_16 = 16,
};

enum group1
{
  g1_encender_lampara = 0,
  g1_apamar_lampara = 1,
};

enum group16
{
  g16_indahaus = 0,
};


int8_t group, idx;

void setup()
{
  // setup pc serial port
  pcserial.begin(9600);

  // 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("---"));
    pcserial.println(f("bridge not started!"));
    break;
    
  case easyvr::bridge_normal:
    // setup easyvr serial port (low speed)
    port.begin(9600);
    // soft-connect 2 serial ports (pc , easyvr)
    easyvr.bridgeloop(pcserial);
    // resume if aborted
    pcserial.println(f("---"));
    pcserial.println(f("bridge connection aborted!"));
    break;
    
  case easyvr::bridge_boot:
    // setup easyvr serial port (high speed)
    port.begin(115200);
    // soft-connect 2 serial ports (pc , easyvr)
    easyvr.bridgeloop(pcserial);
    // resume if aborted
    pcserial.println(f("---"));
    pcserial.println(f("bridge connection aborted!"));
    break;
  }

  while (!easyvr.detect())
  {
    serial.println("easyvr not detected!");
    delay(1000);
  }

  easyvr.setpinoutput(easyvr::io1, low);
  serial.println("easyvr detected!");
  easyvr.settimeout(5);
  easyvr.setlanguage(4);

  group = easyvr::trigger; //<-- start group (customize)
}

void action();

void loop()
{
  easyvr.setpinoutput(easyvr::io1, high); // led on (listening)

  serial.print("say command in group ");
  serial.println(group);
  easyvr.recognizecommand(group);

  do
  {
    // can processing while waiting spoken command
  }
  while (!easyvr.hasfinished());
  
  easyvr.setpinoutput(easyvr::io1, low); // led off

  idx = easyvr.getword();
  if (idx >= 0)
  {
    // built-in trigger (robot)
    // group = group_x; <-- jump 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 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_1:
      switch (idx)
      {
      case g1_encender_lampara:
        // write action code here
        // group = group_x; <-- or jump group x composite commands
        break;
      case g1_apamar_lampara:
        // write action code here
        // group = group_x; <-- or jump group x composite commands
        break;
      }
      break;
    case group_16:
      switch (idx)
      {
      case g16_indahaus:
        // write action code here
        // group = group_x; <-- or jump group x composite commands
        break;
      }
      break;
    }
}


if not see code , this:
#include "arduino.h"
#if !defined(serial_port_monitor)
  #error "arduino version not supported. please update ide latest version."
#endif

#if defined(serial_port_usbvirtual)
  // shield jumper on hw (for leonardo , due)
  #define port serial_port_hardware
  #define pcserial serial_port_usbvirtual
#else
  // shield jumper on sw (using pins 12/13 or 8/9 rx/tx)
  #include "softwareserial.h"
  softwareserial port(12, 13);
  #define pcserial serial_port_monitor
#endif

#include "easyvr.h"

easyvr easyvr(port);

//groups , commands
enum groups
{
  group_1  = 1,
  group_16 = 16,
};

enum group1
{
  g1_encender_lampara = 0,
  g1_apamar_lampara = 1,
};

enum group16
{
  g16_indahaus = 0,
};


int8_t group, idx;

void setup()
{
  // setup pc serial port
  pcserial.begin(9600);

  // 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("---"));
    pcserial.println(f("bridge not started!"));
    break;
   
  case easyvr::bridge_normal:
    // setup easyvr serial port (low speed)
    port.begin(9600);
    // soft-connect 2 serial ports (pc , easyvr)
    easyvr.bridgeloop(pcserial);
    // resume if aborted
    pcserial.println(f("---"));
    pcserial.println(f("bridge connection aborted!"));
    break;
   
  case easyvr::bridge_boot:
    // setup easyvr serial port (high speed)
    port.begin(115200);
    // soft-connect 2 serial ports (pc , easyvr)
    easyvr.bridgeloop(pcserial);
    // resume if aborted
    pcserial.println(f("---"));
    pcserial.println(f("bridge connection aborted!"));
    break;
  }

  while (!easyvr.detect())
  {
    serial.println("easyvr not detected!");
    delay(1000);
  }

  easyvr.setpinoutput(easyvr::io1, low);
  serial.println("easyvr detected!");
  easyvr.settimeout(5);
  easyvr.setlanguage(4);

  group = easyvr::trigger; //<-- start group (customize)
}

void action();

void loop()
{
  easyvr.setpinoutput(easyvr::io1, high); // led on (listening)

  serial.print("say command in group ");
  serial.println(group);
  easyvr.recognizecommand(group);

  do
  {
    // can processing while waiting spoken command
  }
  while (!easyvr.hasfinished());
 
  easyvr.setpinoutput(easyvr::io1, low); // led off

  idx = easyvr.getword();
  if (idx >= 0)
  {
    // built-in trigger (robot)
    // group = group_x; <-- jump 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 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_1:
      switch (idx)
      {
      case g1_encender_lampara:
        // write action code here
        // group = group_x; <-- or jump group x composite commands
        break;
      case g1_apamar_lampara:
        // write action code here
        // group = group_x; <-- or jump group x composite commands
        break;
      }
      break;
    case group_16:
      switch (idx)
      {
      case g16_indahaus:
        // write action code here
        // group = group_x; <-- or jump group x composite commands
        break;
      }
      break;
    }
}

quote
i need project 'm doing vr , arduino easy .
which arduino? how vr connected?



Arduino Forum > Topics > Robotics (Moderator: fabioc84) > Easy VR Shield 3 HELP!


arduino

Comments