Hello everyone,
I have a project using Geeetech voice recognition module. The project is to switch on/off some electronic devices using voice.
I have 4 devices, So I need 8 commands (4 on / 4 off).
So I have to use 2 groups (since Geeetech voice recognition module has 3 groups, each has 5 voice commands - Here is the manuel / Voice_Recognize_manual.pdf )
The problem is that the module can respond to one group at a time only, so I can import one group (I start with group 1 which is the ON commands group), and I can't import the second group at the same time (which is the OFF commands group).
I then got an idea to make the fifth command on group 1 import the group 2 commands, so I can then spell the OFF commands (Also the fifth command of group 2 import the group 1 commands).
The problem now is with the code, I'm not a good programmer so I need your ideas in how to make this work.
Here is the code /
int AC = 9;
int TV = 10;
int FAN = 11;
int LIGHT = 12;
byte com = 0; //reply from voice recognition
void setup() {
Serial.begin(9600);
pinMode(AC, OUTPUT);
pinMode(TV, OUTPUT);
pinMode(FAN, OUTPUT);
pinMode(LIGHT, OUTPUT);
Serial.begin(9600);
delay(2000);
Serial.write(0xAA);
Serial.write(0x37);
delay(1000);
Serial.write(0xAA);
Serial.write(0x21); //Importing group 1 commands
}
void loop()
{
while(Serial.available())
{
// Serial.write(0x21);
com = Serial.read();
switch(com)
{
case 0x11:
digitalWrite(AC, HIGH);
break;
case 0x12:
digitalWrite(TV, HIGH);
break;
case 0x13:
digitalWrite(FAN, HIGH);
break;
case 0x14:
digitalWrite(LIGHT, HIGH);
break;
case 0x15:
delay(1000);
Serial.write(0xAA);
Serial.write(0x22); //Importing group 2 commands
break;
}
// Serial.write(0x22);
com = Serial.read();
switch(com)
{
case 0x11:
digitalWrite(AC, LOW);
break;
case 0x12:
digitalWrite(TV, LOW);
break;
case 0x13:
digitalWrite(FAN, LOW);
break;
case 0x14:
digitalWrite(LIGHT, LOW);
break;
case 0x15:
delay(1000);
Serial.write(0xAA);
Serial.write(0x21);
break;
}
}
}
I want to transfer from group 1 commands to group 2 commands and break the group 1 loop and stuck in group 2 loop until the command of case 0x15 came and transfer the program to group 1 again.
I hope you get the idea.