Voice Recognition V3 Codes Need Explanation

Hello everyone, I have this project Talking Clock. It speaks the time when I say a command “time”. So it involves VRV3 module, RTC, Arduino, and WaveShield. Now, our professor asked me to explain the codes in the Voice Recognition, particularly the value of VR.load(timeRecord) so that I can compare it to zero, from the statement

if(myVR.load((uint8_t)timeRecord) >= 0)
Serial.println(“timeRecord loaded”)

The same in these lines,

void loop()

int ret;
ret = myVR.recognize(buf,50);
if(ret>0)
switch(buf[1])
case timeRecord;
digitalWrite(ledTime, LOW);
delay(1000);
digitalWrite(ledTime, HIGH);
break;

I’m trying to control LED depends on the voice command being recognized. But our professor asked me the value of “buf” so that the value myVR.recognize(buf,50) will be the value of “ret”.

Any reply is very much appreciated. Thank You.

This is the arduino file I had copied from the VR library.

vr_sample_control_led.ino (3.31 KB)

I'm trying to control LED depends on the voice command being recognized. But our professor asked me the value of "buf" so that the value myVR.recognize(buf,50) will be the value of "ret".

You need to look at the documentation of the library that you did not provide a link to, so see what the recognize() method does. The return value from the function is stored in the variable named ret. The value will NEVER be "ret".

Thank you for the reply sir. I already looked the VR library but still I don’t understand, the recognize(), load(), etc, I will be very thankful sir if you could share your idea about what is exactly this return value. Also the value of myVR.load((uint8_t)timeRecord) sir, so that I can compare it to zero. Thank you again sir.

VR3 Library Reference.pdf (55.3 KB)

I don't know what idiot wrote that library, but the documentation was generated from the code using doxygen. The result is garbage, so the input (the header file, specifically) is junk.

/**
@brief VR class constructor.
@param buf --> return data .
buf[0] --> Group mode(FF: None Group, 0x8n: User, 0x0n:System
buf[1] --> number of record which is recognized.
buf[2] --> Recognizer index(position) value of the recognized record.
buf[3] --> Signature length
buf[4]~buf[n] --> Signature
timeout --> wait time for receiving packet.
@retval length of valid data in buf. 0 means no data received.
*/
int VR :: recognize(uint8_t *buf, int timeout)

That function is NOT a class constructor.

The rest of the comments are probably correct. They answer all of your questions.

Sir, so what is exactly the function called if not a class constructor? What is also a return value sir? Where can i get that value based on my project?

so what is exactly the function called if not a class constructor?

It is a method. The developer should have put a comment in the file describing what the method is for.

What is also a return value sir?

It is a value that a function returns. The recognize() method returns some value when it gets done. The documentation tells you what the value is/means.

Where can i get that value based on my project?

WalMart. I really don't understand the question. If you want to say "Left field" to make a LED turn on, you need to define an entry in a a group. The group number is the first entry in the buf array that is populated by the method.

The rest of the values depend on code that you have not posted. Post ALL of your code AND a link to the library.

Here is the code sir.

TalkingClock.ino (1.21 KB)

fxlnxjude:
Here is the code sir.

Why not post it here ? Remembering, of course, to use code tags as described in read this before posting a programming question

Sir, am I sending my concerns as personal messages? I am new here, and I try to find this </> button, that’s how I can do code tags, right? Where is it sir?

Where is it sir?

Above the text entry field, there are icons and smiley faces. The left-most icon on the top row...

I found it sir. Thank you for the info.

Here are the codes:

#include <SoftwareSerial.h>
#include "VoiceRecognitionV3.h"

/**        
  Connection
  Arduino    VoiceRecognitionModule
   2   ------->     TX
   3   ------->     RX
*/
VR myVR(2,3);    // 2:RX 3:TX, you can choose your favourite pins.

uint8_t records[7]; // save record
uint8_t buf[64];

int const ledTime = 13

#define timeRecord (0)

void setup() {
  /** initialize */
  myVR.begin(9600);
  
  Serial.begin(115200);
  Serial.println("Elechouse Voice Recognition V3 Module\r\nControl LED sample");
  
  pinMode(ledTime, OUTPUT); digitalWrite(ledTime, HIGH);
    
  if(myVR.clear() == 0){
    Serial.println("Recognizer cleared.");
  }else{
    Serial.println("Not find VoiceRecognitionModule.");
    Serial.println("Please check connection and restart Arduino.");
    while(1);
  }
  if(myVR.load((uint8_t)timeRecord) >= 0){
    Serial.println("timeRecord loaded");
  }

}

void loop() {
  int ret;
  ret = myVR.recognize(buf, 50);
  if(ret>0){
    switch(buf[1]){
      case timeRecord:
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        break;
      default:
        Serial.println("Record function undefined");
        break;
    }
    /** voice recognized */
    printVR(buf);
  }
}

how can i use vr3 voice recognition module in group mode using arduino uno?

Can you tell us exactly what the "VR3" is? Ideally, with a link to the product page.