#include <EasyVR.h>
EasyVR easyvr(Serial); // Create an EasyVR object
const byte red = 11;
const byte green = 10;
const byte blue = 9;
void setup() {
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
Serial.begin(9600); // Initialize serial communication
}
void loop() {
easyvr.recognizeCommand(0); // Start listening for commands in group 0
int group, idx;
if (easyvr.getCommand() > 0) { // Check for a recognized command
// group = easyvr.sendGroup(); // Removed unnecessary call
idx = easyvr.getID(); // Get the index of the recognized command
if (group == 0 && idx == 0) { // If "On" is recognized (assuming group 0)
digitalWrite(red, HIGH);
digitalWrite(green, HIGH);
digitalWrite(blue, HIGH);
} else if (group == 0 && idx == 1) { // If "Off" is recognized
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
}
}
}