code arduino easyvr

Hello, I would like to turn on and off an LED by voice command, I positioned the LED on the 10 pin and gnd and here is the code I tried to do but it does not work, can you help me please? Regards Dimitri

#include “Arduino.h”
#if !defined(SERIAL_PORT_MONITOR)
#error “Arduino version not supported. Please update your IDE to the latest version.”
#endif

#if defined(SERIAL_PORT_USBVIRTUAL)
// Shield Jumper on HW (for Leonardo and Due)
#define port SERIAL_PORT_HARDWARE
#define pcSerial SERIAL_PORT_USBVIRTUAL
#else
// Shield Jumper on SW (using pins 12/13 or 8/9 as RX/TX)
#include “SoftwareSerial.h”
SoftwareSerial port(12, 13);
#define pcSerial SERIAL_PORT_MONITOR
#endif

#include “EasyVR.h”

EasyVR easyvr(port);

#define LED_PIN 10
//Groups and Commands
enum Groups
{
GROUP_15 = 15,
};

enum Group15
{
G15_OUVRIR = 0,
G15_FERMER = 1,
};

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 the two serial ports (PC and EasyVR)
easyvr.bridgeLoop(pcSerial);
// resume normally 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 the two serial ports (PC and EasyVR)
easyvr.bridgeLoop(pcSerial);
// resume normally 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(5);

group = EasyVR::TRIGGER; //<-- start group (customize)
pinMode(10, OUTPUT);
}

void action();

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

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

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

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

idx = easyvr.getWord();
if (idx >= 0)
{
// 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();
// beep
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_15:
switch (idx)
{
case G15_OUVRIR:
digitalWrite(10, HIGH);
group = GROUP_15;
break;
case G15_FERMER:
digitalWrite(10, LOW);
group = GROUP_15;
break;
}
break;
}
}

What do you mean by “it does not work”?

When you post a question related to a 3rd party library it’s useful to provide a link or information on where you downloaded it from or whether you installed it using Library Manager(I see it is in Library Manager). This saves us the trouble of searching and prevents confusion when there are multiple versions of the library with the same name.

Please use code tags(</> button on the toolbar) when you post code or error/warning messages.

Hello, I downloaded easyvrcommander and easyvrlibrary on Downloads - Fortebit and I downloaded the software arduino1.6.9 on the official website, my problem is that I have uploaded the code below above on arduino, there is no error in the upload, except that when I try to run the voice command that I recorded on easycommander, it does not work Regards