I am using two Xbees, I am using voice module elechouse v3
that operates on 115200 baud rate. I want voice module to process voice at transmission end and glow an led with it at receivers end.
Problem is the baud rate 115200, should Xbees be set on the same baud rate as well ? How to do it ?
voice module code is
/**
- @file vr_sample_control_led.ino
- @author JiapengLi
-
@brief This file provides a demostration on
how to control led by using VoiceRecognitionModule
-
@note:
voice control led
-
@section HISTORY
2013/06/13 Initial version.
*/
#include
#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 led = 13;
#define onRecord (0)
#define offRecord (1)
/**
@brief Print signature, if the character is invisible,
print hexible value instead.
@param buf –> command length
len –> number of parameters
*/
void printSignature(uint8_t *buf, int len)
{
int i;
for(i=0; i0x19 && buf[i]<0x7F){
Serial.write(buf[i]);
}
else{
Serial.print(“[”);
Serial.print(buf[i], HEX);
Serial.print(“]”);
}
}
}
/**
@brief Print signature, if the character is invisible,
print hexible value instead.
@param buf –> VR module return value when voice is recognized.
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
*/
void printVR(uint8_t *buf)
{
Serial.println(“VR Index Group RecordNum Signature”);
Serial.print(buf[2], DEC);
Serial.print(" ");
if(buf[0] == 0xFF){
Serial.print(“NONE”);
}
else if(buf[0]&0x80){
Serial.print("UG ");
Serial.print(buf[0]&(~0x80), DEC);
}
else{
Serial.print("SG “);
Serial.print(buf[0], DEC);
}
Serial.print(” ");
Serial.print(buf[1], DEC);
Serial.print(" “);
if(buf[3]>0){
printSignature(buf+4, buf[3]);
}
else{
Serial.print(“NONE”);
}
Serial.println(”
");
}
void setup()
{
/** initialize */
myVR.begin(9600);
Serial.begin(115200);
Serial.println(“Elechouse Voice Recognition V3 Module
Control LED sample”);
pinMode(led, OUTPUT);
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)onRecord) >= 0){
Serial.println(“onRecord loaded”);
}
if(myVR.load((uint8_t)offRecord) >= 0){
Serial.println(“offRecord loaded”);
}
}
void loop()
{
int ret;
ret = myVR.recognize(buf, 50);
if(ret>0){
switch(buf[1]){
case onRecord:
/** turn on LED /
digitalWrite(led, HIGH);
break;
case offRecord:
/* turn off LED*/
digitalWrite(led, LOW);
break;
default:
Serial.println(“Record function undefined”);
break;
}
/** voice recognized */
printVR(buf);
}
}
what should be the code at receiver and ransmitter ?