Hi all.
I ran the code given below on my Arduino Uno and then interfaced it with "GEETECH Voice Recognition Module" (user manual attached below).
The VR module successfully reads my Serial.Write command given in void setup() but not in void loop()!
After the Serial.write(0x21) command in void setup(), VR module successfully imports group 1 of my voice instructions.
But (for example) in Case 0x11 in void loop(), it is supposed to import group 2 of my voice instructions so that I gain access to case 0x21, case 0x22, case 0x23, it is not doing that!
void setup()
{
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
delay(2000);
Serial.write(0xAA);
Serial.write(0x37);
delay(1000);
Serial.write(0xAA);
Serial.write(0x21);
}
void loop()
{
byte k = 0;
byte led = 0;
byte com = 0;
while(Serial.available())
{
com = Serial.read();
switch(com)
{
case 0x11:
delay(1000);
Serial.write(0xAA);
Serial.write(0x22);
digitalWrite(2,HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
k=1;
break;
case 0x12:
delay(1000);
Serial.write(0xAA);
Serial.write(0x22);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
k=4;
break;
case 0x13:
delay(1000);
Serial.write(0xAA);
Serial.write(0x22);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
k=7;
break;
case 0x14:
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
digitalWrite(13, LOW);
break;
case 0x15:
break;
case 0x21:
delay(1000);
Serial.write(0xAA);
Serial.write(0x23);
led = k+1;
break;
case 0x22:
delay(1000);
Serial.write(0xAA);
Serial.write(0x23);
led = k+2;
break;
case 0x23:
delay(1000);
Serial.write(0xAA);
Serial.write(0x23);
led = k+3;
break;
case 0x24:
delay(1000);
Serial.write(0xAA);
Serial.write(0x21);
break;
case 0x25:
break;
case 0x31:
digitalWrite(led, HIGH);
break;
case 0x32:
digitalWrite(led, LOW);
break;
case 0x33:
delay(1000);
Serial.write(0xAA);
Serial.write(0x22);
break;
case 0x34:
break;
case 0x35:
break;
default:
break;
}
}
}
User Manual.pdf (604 KB)