Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Easyvr - Domotics - Help on: December 05, 2012, 10:34:51 am
I put a 11h, but it get a compile error. If anyone could help me I really, really appreciate it.
2  Using Arduino / Programming Questions / Re: Easyvr - Domotics - Help on: December 05, 2012, 06:01:58 am
I think the program is not generate the error. I think that the if inside de Case G16_PWD_LUIZ is not working.

Follow:

Code:

case G16_PWR_LUIZ:
      {
      int16_t err1 = easyvr.getError();
      if (err1 >= 11)
    {
      easyvr.playSound(1, EasyVR::VOL_FULL);
      digitalWrite(10, HIGH);
      delay(500);
      digitalWrite(10, LOW);
      delay(500);
      digitalWrite(10, HIGH);
      delay(500);
      digitalWrite(10, LOW);
      delay(500);
      digitalWrite(10, HIGH);
      delay(500);
      digitalWrite(10, LOW);
      }
       else{
        easyvr.playSound(2, EasyVR::VOL_FULL);
        digitalWrite(9, HIGH);
        delay(5000);
        digitalWrite(9, LOW);// write your action code here
        group = (0);
       }// group = GROUP_X; <-- or jump to another group X for composite commands
      }
        break;
      }
      break;
    }


Here we go, the pins are: 8 - Living Room, 3 - Hall, 4 - Room, 9 - Red Led installed in the driveway, 10 - Green Led installed in the driveway, M2 - blind motor and led, another led controled by light sensor.

I did not gave the meaningful names, because the forum post limits on the maximum number of 9500 characters, and my first post of 9500 had passed characters.

If I need to put more information please let me know.
3  Using Arduino / Programming Questions / Re: Easyvr - Domotics - Help on: December 04, 2012, 04:21:10 pm
Thanks for helping me.

This program besides turn on or turn off the light, it also control access home

In my code, after the trigger when I say "Entrada" (a word registred in group 2, that means I want to enter in the house) it goes for group 1, and when I said a word (User name) registred in group 1, it goes for group 16, if I said some word that is not registred in group 1, it should generate an error, and blink a red led and play a buzzer after three attemps. But if everything is ok, it goes for group 16.
In group 16 If I said the correct passaword for this User Name (registred in group 1), it plays a sound recorded in sound table that means that the user have the garanteed access to home and the system goes back to group 0, waiting for the trigger. If the password was wrong it shoud generate an error and blink a red led a play a buzzer after three atemps, the same procedure if the user name was not registred. I am trying to do the same as Control Access Home in the Veear web site.

Link: http://www.veear.eu/downloads/

Can you help me?
4  Using Arduino / Programming Questions / Easyvr - Domotics - Help on: December 04, 2012, 11:58:36 am
This program will turn on or off lights and open or close blind.
I want to say a command "Entrada" e goes to group 1 if the name, saved in this group was right goes to group 16 (pwd), otherwise the program counts three attemps and blink a red led and plays buzzer for 5 secs. If program goes to group 16, that means that the name said was correct, and evething was right, the program plays a sound in sound table and goes to group 0, otherwise the program do the same procedure when the name is wrong. What I really want to do is put a If inside a Switch case, is that possible? If anyone could help me out I would appreciate it.

Code:

#include <EasyVR.h>

#define SND_SON_FINAL_1            1
#define SND_SON_FINAL_2            2
#define SND_SON_FINAL_3            3
#define SND_SON_FINAL_4            4
#define SND_SON_FINAL_5            5
#define SND_SON_FINAL_6            6
#define SND_SON_FINAL_7            7
#define SND_SON_FINAL_8            8
#define SND_SON_FINAL_9            9

EasyVR easyvr(port);

enum Groups
{
  GROUP_0  = 0,
  GROUP_1  = 1,
  GROUP_2  = 2,
  GROUP_3  = 3,
  GROUP_4  = 4,
  GROUP_5  = 5,
  GROUP_6  = 6,
  GROUP_7  = 7,
  GROUP_8  = 8,
  GROUP_16 = 16,
  Entrada = 17
};

enum Group0
{
  G0_CASA = 0,
};

enum Group1
{
  G1_LUIZ_MOURA = 0,
};

enum Group2
{
  G2_ILUMINACAO = 0,
  G2_PERSIANA = 1,
  G2_CANCELA_COMANDO = 2,
  G2_ATALHO_OFF = 3,
  G2_SAINDO = 4,
  G2_ENTRADA = 5,
};

enum Group3
{
  G3_ESTAR = 0,
  G3_SALA = 1,
  G3_QUARTO = 2,
};

enum Group4
{
  G4_LIGA = 0,
  G4_DESLIGA = 1,
  G4_CANCELA_LUZ = 2,
};

enum Group5
{
  G5_ABRE_PERSIANA = 0,
  G5_FECHA_PERSIANA = 1,
  G5_CANCELAR_PERSIANA = 2,
};

enum Group6
{
  G6_LIGA = 0,
  G6_DESLIGA = 1,
  G6_CANCELAR_LUZ = 2,
};

enum Group7
{
  G7_LIGA = 0,
  G7_DESLIGA = 1,
  G7_CANCELAR_LUZ = 2,
};

enum Group8
{
  G8_DESLIGA_ESTAR = 0,
  G8_DESLIGA_QUARTO = 1,
  G8_DESLIGA_SALA = 2,
  G8_DESLIGA_TUDO = 3,
};

enum Entrada
{
  Wake_on_char = 0,
};

enum Group16
{
  G16_PWR_LUIZ = 0,
};

EasyVRBridge bridge;

int8_t group, idx;

int E2 = 6;                      
int M2 = 7;
const int LDR = 14;
int ValorLido = 0;
int ValorLido2 = 0;
const int led = 5;

void setup()
{
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
   Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(0);
  
  pinMode(8, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(M2, OUTPUT);
  pinMode(led, OUTPUT);
  
}

void action();

void loop()
{
 int idx_nome;
 int idx_pwd;
 char wake[32];
 int nome_nc;
 int count=0;
 
  easyvr.setPinOutput(EasyVR::IO1, HIGH);

  Serial.print("Diga um comando do grupo ");
  Serial.println(group);
  easyvr.recognizeCommand(group);

   do
  {
  ValorLido = analogRead(LDR);  
  if (ValorLido < 5){
   digitalWrite(led, HIGH);  
  }          
  else{
   digitalWrite(led, LOW);
  }
  }
  
  while (!easyvr.hasFinished());
  
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  idx = easyvr.getWord();
  if (idx >= 0)
  {
return;
  }
  idx = easyvr.getCommand();
  if (idx >= 0)
  {
    // print debug message
    uint8_t train = 0;
    char name[32];
    Serial.print("Command: ");
    Serial.print(idx);
    if (easyvr.dumpCommand(group, idx, name, train))
    {
      Serial.print(" = ");
      Serial.println(name);
    }
    else
      Serial.println();
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // perform some action
    action();
  }
  else // errors or timeout
  {
    if (easyvr.isTimeout())
      Serial.println("Timed out, try again...");
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      Serial.print("Error ");
      Serial.println(err, HEX);
      easyvr.playSound(8, EasyVR::VOL_FULL);
    }
  }
}

void action()
{
     switch (group)

    {
    case GROUP_0:
      switch (idx)
      {
      case G0_CASA:
        easyvr.playSound(4, EasyVR::VOL_FULL);
        group = (2);
        break;
      }
      break;
    case GROUP_1:
      switch (idx)
      {
      case G1_LUIZ_MOURA:
        easyvr.playSound(9, EasyVR::VOL_FULL);
        group = (16);
        break;
      }
      break;
    case GROUP_2:
      switch (idx)
      {
      case G2_ILUMINACAO:
        easyvr.playSound(5, EasyVR::VOL_FULL);
        group = (3);
        break;
      case G2_PERSIANA:
        easyvr.playSound(7, EasyVR::VOL_FULL);
        group = (5);
        break;
      case G2_CANCELA_COMANDO:
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
        case G2_ATALHO_OFF:
        easyvr.playSound(7, EasyVR::VOL_FULL);
        group = (8);
        break;
      case G2_SAINDO:
        easyvr.playSound(7, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        easyvr.sleep(0);
        break;
        case G2_ENTRADA:
        easyvr.playSound(6, EasyVR::VOL_FULL);
        group = (1);
        break;
      }
      break;
    case GROUP_3:
      switch (idx)
      {
      case G3_ESTAR:
        easyvr.playSound(7, EasyVR::VOL_FULL);
        group = (4);
        break;
      case G3_SALA:
        easyvr.playSound(7, EasyVR::VOL_FULL);
        group = (6);
        break;
      case G3_QUARTO:
        easyvr.playSound(7, EasyVR::VOL_FULL);
        group = (7);
        break;
      }
      break;
    case GROUP_4:
      switch (idx)
      {
      case G4_LIGA:
        digitalWrite(8, HIGH);
        break;
      case G4_DESLIGA:
        digitalWrite(8, LOW);
        break;
      case G4_CANCELA_LUZ:
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      }
      break;
    case GROUP_5:
      switch (idx)
      {
      case G5_ABRE_PERSIANA:
      digitalWrite(M2,HIGH);  
      digitalWrite(E2,HIGH);      
      delay(2200);
      digitalWrite(M2,LOW);  
      digitalWrite(E2,LOW);
      break;
      case G5_FECHA_PERSIANA:
      digitalWrite(M2,LOW);  
      digitalWrite(E2,HIGH);
      delay(1600);
      digitalWrite(M2,LOW);  
      digitalWrite(E2,LOW);
      break;
      case G5_CANCELAR_PERSIANA:
      easyvr.playSound(3, EasyVR::VOL_FULL);
      easyvr.setPinOutput(EasyVR::IO1, LOW);
      group = (0);
      break;
      }
      break;
      case GROUP_6:
      switch (idx)
      {
      case G6_LIGA:
        digitalWrite(3, HIGH);
        break;
      case G6_DESLIGA:
        digitalWrite(3, LOW);
        break;
      case G6_CANCELAR_LUZ:
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      }
      break;
    case GROUP_7:
      switch (idx)
      {
      case G7_LIGA:
        digitalWrite(4, HIGH);
        break;
      case G7_DESLIGA:
        digitalWrite(4, LOW);
        break;
      case G7_CANCELAR_LUZ:
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      }
      break;
    case GROUP_8:
      switch (idx)
      {
      case G8_DESLIGA_ESTAR:
        digitalWrite(8, LOW);
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      case G8_DESLIGA_QUARTO:
        digitalWrite(4, LOW);
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      case G8_DESLIGA_SALA:
        digitalWrite(3, LOW);
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      case G8_DESLIGA_TUDO:
        digitalWrite(8, LOW);
        digitalWrite(3, LOW);
        digitalWrite(4, LOW);
        digitalWrite(5, LOW);
        digitalWrite(M2,LOW);  
        digitalWrite(E2,HIGH);
        delay(1500);
        digitalWrite(M2,LOW);  
        digitalWrite(E2,LOW);        
        easyvr.playSound(3, EasyVR::VOL_FULL);
        easyvr.setPinOutput(EasyVR::IO1, LOW);
        group = (0);
        break;
      }
      break;
    case GROUP_16:
      switch (idx)
      {
      case G16_PWR_LUIZ:
      {
      int16_t err1 = easyvr.getError();
      if (err1 >= 11)
    {
      easyvr.playSound(1, EasyVR::VOL_FULL);
      digitalWrite(10, HIGH);
      delay(500);
      digitalWrite(10, LOW);
      delay(500);
      digitalWrite(10, HIGH);
      delay(500);
      digitalWrite(9, LOW);
      delay(500);
      digitalWrite(10, HIGH);
      delay(500);
      digitalWrite(9, LOW);
      }
       else{
        easyvr.playSound(2, EasyVR::VOL_FULL);
        digitalWrite(9, HIGH);
        delay(5000);
        digitalWrite(9, LOW);
        group = (0);
       }
      }
        break;
      }
      break;
    }
    
}
5  Using Arduino / Audio / Put Easyvr to sleep and wake on: November 04, 2012, 10:12:23 am
Hello everyone I am new here and am developing a project using EasyVR for home automation and need some help, when I say to the rest to EasyVR through a voice command, it enters sleep mode and press a button when he wakes up and starts speech recognition. I'm not able to make it stop with voice recognition and much less do it by waking button. To generate the code I'm using Easy Commander, can anyone help me please?
6  International / Portugues / Easyvr Dormir e Acordar on: November 04, 2012, 09:55:24 am
Olá pessoal, sou novo aqui e estou fazendo um projeto de automação doméstica com o arduíno UNO e o Shield Easyvr e quando eu disser o comando "Descansar" o EasyVR entra em modo sleep, e quando eu apertar um botão o easyvr liga de novo, estou tendo muitas dificuldades se alguém puder me ajudar sou eternamente grato.
Pages: [1]