EasyVR Help about vocale recognition, please


hello

i've arduino mega 2560 easyvr shield.

i sounds tables ok, don't khnow how switch led (pin13) on, after vocale recognition.

here code :
code: [select]

#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 , commands
enum groups
{
};


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(5);

 group = easyvr::trigger; //<-- start group (customize)
 pinmode(13, output);
}

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()
{
   digitalwrite(13, low);
   if (idx == 0){
     digitalwrite(13, high);
   }
   switch (group)
   {
   }
}


thanks in advance

(ps : speak french)

please edit post , add code tags around source code -> [code][/code]

what debug output when run code? add debug message @ start of action() showing value of idx.


Arduino Forum > Using Arduino > Programming Questions > EasyVR Help about vocale recognition, please


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial