// O ERRO ACONTECE QUANDO TENTO RODAR O RF JUNTO COM EASYVR
// ME AJUDEM POR FAVOR
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#else // Arduino 0022 – use modified NewSoftSerial
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif
#include "EasyVR.h"
#include "Wire.h"
#include <VirtualWire.h>
#define DS1307_ADDRESS 0x68
byte zero = 0x00;
EasyVR easyvr(port);
//Groups and Commands
enum Groups
{
//GROUP_0 = 0,
GROUP_1 = 1,
};
enum Group0
{
G0_ARDUINO = 0,
};
enum Group1
{
G1_SALA = 0,
G1_COZINHA = 1,
G1_LAVANDERIA = 2,
G1_CASAL = 3,
G1_CRIANCAS = 4,
G1_BANHEIRO = 5,
};
EasyVRBridge bridge;
int8_t group, idx;
void setup()
{
// AQUI ESTA O ERRO
vw_set_ptt_inverted(true);
vw_setup(200); // NESSA LINHA AQUI QUE PERCEBI
vw_set_rx_pin(2); //Configura o pino D2 para a leitura dos dados
// ERRRO
vw_set_ptt_inverted(true);
vw_setup(2000); // ERRO NO USO DE TIMERS
vw_set_tx_pin(3);
Wire.begin();
// bridge mode?
if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13);
}
// run normally
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(EasyVR::ENGLISH);
group = EasyVR::TRIGGER; //&lt;– start group (customize)
}
void action();
void loop()
{
easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
Serial.print("Say a command in Group");
Serial.println(group);
easyvr.recognizeCommand(group);
do
{
// can do some processing while waiting for a spoken command
}
while (!easyvr.hasFinished());
easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off
idx = easyvr.getWord();
if (idx >= 0)
{
// built-in trigger (ROBOT)
// group = GROUP_X; &lt;– jump to another group X
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);
}
group = GROUP_1;
}
}
void action()
{
}
Tags:
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por