Hi everybody
So i bought bitvoicer for speech recognition and i can't find any tutorials on how to program it in the arduino software, :0 if anyone knows where i can find something it will be greatly appreciated
Thanks
I tryed all of these the code doesn't work most of the time and the other times there isn't any code at all.
what i want to be able to do is control a relay with it.
Did you follow the examples in the user manual?
http://www.bitsophia.com/Files/BitVoicer_v12_Manual_en.pdf
I think you want section 5.5.2: "Audio Captured by a Microphone Wired to the Microcontroller"
If that does not work for you, you may want to return your board as defective.
no the examples work its just i don't know enough of the code to change it how i want it. the codes on the internet don't work with the current version of bitVoicer.
whitewolf578:
no the examples work its just i don't know enough of the code to change it how i want it. the codes on the internet don't work with the current version of bitVoicer.
Sounds like you need to read the manual more.
I think you need to create a "Voice Schema". That's described in Section 4 of the manual, starting on Page 11. You design sentences to do what you want and then assign each permutation of each sentence a value. Your sketch then looks at the value to figure out what was said.
I figured it out thanks for your help. Heres the code i had to rewrite It'll work with two LEDS:
//Includes the BitVoicer library to the sketch
#include <BitVoicer11.h>
//Sets up the pins and default variables
int pinR = 3;
int pinG = 5;
int blinkDelay = 250;
int sequenceDir = 0;
int lightLevel = 0;
//Creates a new instance of the BitVoicerSerial class
//Sets up serial port to 0
BitVoicerSerial bvSerial = BitVoicerSerial();
void setup()
{
//Starts serial communication and sets up the pinModes
Serial.begin(9600);
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
}
void loop()
{
//Retrieves data from serial buffer
bvSerial.getData();
//Quits the loop if no string data was returned from getData
if (bvSerial.strData == "")
{
return;
}
//Each of the next 'if' statements performs a different
//task based on the data received from BitVoicer
if (bvSerial.strData == "wake")
{
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
delay(200);
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
delay(200);
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
delay(200);
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
delay(200);
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
delay(200);
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
bvSerial.strData = "";
lightLevel = 0;
}
else if (bvSerial.strData == "sleep")
{
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
delay(200);
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
delay(200);
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
delay(200);
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
bvSerial.strData = "";
lightLevel = 0;
}
else if (bvSerial.strData == "RH")
{
digitalWrite(pinR, HIGH);
bvSerial.strData = "";
lightLevel = 255;
}
else if (bvSerial.strData == "RL")
{
digitalWrite(pinR, LOW);
bvSerial.strData = "";
lightLevel = 0;
}
else if (bvSerial.strData == "GH")
{
digitalWrite(pinG, HIGH);
bvSerial.strData = "";
lightLevel = 255;
}
else if (bvSerial.strData == "GL")
{
digitalWrite(pinG, LOW);
bvSerial.strData = "";
lightLevel = 0;
}
else if (bvSerial.strData == "blink")
{
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
delay(blinkDelay);
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
delay(blinkDelay);
lightLevel = 255;
}
else if (bvSerial.strData == "BF")
{
blinkDelay = 100;
bvSerial.strData = "blink";
lightLevel = 255;
}
else if (bvSerial.strData == "BFF")
{
switch (blinkDelay)
{
case 500:
blinkDelay = 250;
break;
case 250:
blinkDelay = 100;
break;
default:
break;
}
bvSerial.strData = "blink";
lightLevel = 255;
}
else if (bvSerial.strData == "BS")
{
blinkDelay = 500;
bvSerial.strData = "blink";
lightLevel = 255;
}
else if (bvSerial.strData == "BSS")
{
switch (blinkDelay)
{
case 100:
blinkDelay = 250;
break;
case 250:
blinkDelay = 500;
break;
default:
break;
}
bvSerial.strData = "blink";
lightLevel = 255;
}
else if (bvSerial.strData == "sequence")
{
if (sequenceDir == 0)
{
digitalWrite(pinR, HIGH);
delay(250);
digitalWrite(pinR, LOW);
delay(250);
digitalWrite(pinG, HIGH);
delay(250);
digitalWrite(pinG, LOW);
}
else
{
digitalWrite(pinG, HIGH);
delay(250);
digitalWrite(pinG, LOW);
delay(250);
digitalWrite(pinR, HIGH);
delay(250);
digitalWrite(pinR, LOW);
}
lightLevel = 255;
}
else if (bvSerial.strData == "revert")
{
if (sequenceDir == 0)
{
sequenceDir = 1;
}
else
{
sequenceDir = 0;
}
bvSerial.strData = "sequence";
lightLevel = 255;
}
else if (bvSerial.strData == "ALLON")
{
digitalWrite(pinR, HIGH);
digitalWrite(pinG, HIGH);
bvSerial.strData = "";
lightLevel = 255;
}
else if (bvSerial.strData == "ALLOFF")
{
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
bvSerial.strData = "";
lightLevel = 0;
}
else if (bvSerial.strData == "brighter")
{
if (lightLevel < 255)
{
lightLevel += 85;
analogWrite(pinR, lightLevel);
analogWrite(pinG, lightLevel);
}
bvSerial.strData = "";
}
else if (bvSerial.strData == "darker")
{
if (lightLevel > 0)
{
lightLevel -= 85;
analogWrite(pinR, lightLevel);
analogWrite(pinG, lightLevel);
}
bvSerial.strData = "";
}
else
{
Serial.println("ERROR:" + bvSerial.strData);
bvSerial.strData = "";
}
}