Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a project that uses the voice recognition module V3 and an Arduino Uno to output a 5V signal that will run a solid state relay. I trained the V3 using AccessPort successfully with the commands "lights on, lights off, fan on, fan off." I used this instructable as reference but the author uses V2 instead of V3. http://www.instructables.com/id/Arduino-voice-control/

#include <SoftwareSerial.h>




//SoftwareSerial mySerial(0, 1); //rx amd tx 

int lightOn = 9;  //connected to lED 
int fanOn = 10;   //connected to fan

byte com = 0; //Transmission from V3, Receive on Arduino Yun Pin 0 

void setup()
{
Serial.begin(9600);

pinMode(lightOn, OUTPUT); 
pinMode(fanOn, OUTPUT); 

delay(2000); 

/* This next part is where I think I'm stuck. I'm not sure if this is needed" */

/*
Serial.write(0xAA);  //head (AA)
Serial.write(0x06);  //Length 
Serial.write(0x30);  //Command
Serial.write(0x01);  // load command indexed 1 (signature: lights on) 
Serial.write(0x02);  // load command indexed 2 (signature: lights off) 
Serial.write(0x03);  // load command indexed 3 (signature: fan on) 
Serial.write(0x04);  // load command indexed 4 (signature: fan off) 
Serial.write(0x0A);  //end (0A) 
*/

}

void loop()
{
while(Serial.available())
{
com = Serial.read();
switch(com)
{
case 0x01:  //v3 recognized 
digitalWrite(lightOn, HIGH);    //Pin 9 goes HIGH, turning on light 
break;

case 0x02:
digitalWrite(lightOn, LOW);     //Pin 9 goes LOW, turning off light
break;

case 0x03:
digitalWrite(fanOn, HIGH);     //Pin 10 goes High, turning on fan 
break;

case 0x04:
digitalWrite(fanOn, LOW);     //Pin 10 goes LOW, turning off fan 
break;

    }
  }
}

Could I get some advice of what's wrong with my code?

I think my problem is with getting my Uno and the V3 to communicate. The problem is I don't really understand how the TX and RX work for this. And the documentation PDF is terrible on how the communication for this module works. http://www.elechouse.com/elechouse/images/product/VR3/VR3_manual.pdf

Any help on the matter would be appreciated.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.