Saturday, October 21, 2017

Arduino Voice Recognition


VOICE RECOGNITION APP

Arduino Sketch:
/* ===============================================================
      Project: VOICE CONTROL HOME AUTOMATION
      Author: J. B. Wylzan 
      Website: http://www.ihackrobot.blogspot.com
      Abstract: How to control an led using SPEECH or VOICE
================================================================== */

#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX

 int ledPin = 12;
 String vox;
 int x=10;
 int var=0;

void setup()
{
     pinMode(ledPin, OUTPUT);
     BTserial.begin(9600);
     // Serial.begin(9600);
     // BTserial.println("Speech Recognition");
}

void loop()
{
    while (BTserial.available())
    {
  delay(x);
    char c = BTserial.read();            
    vox += c;
     }
if (vox.length() > 0) {

  if(vox== "on")
  {
    digitalWrite(ledPin , HIGH);
  }

  if(vox== "off")
  {
    digitalWrite(ledPin , LOW);
  }
     vox="";       //Reset the variable
}
}



 




Warning: : If an application is requesting permission to access any information of your phone or tablet, it is your sole own discretion if you provide permission or not. IHackRobot is not affiliated with the contents of the application or even its owner.

Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 

 ==================================================================
"Humans became conscious because of Mother Nature." 
~ Joey Lawsin
==================================================================

NOTICE: Articles on this site are composed on random thoughts. The transcript may not be in its final form. It maybe edited, updated or even revised in the future based on the outcomes of  the author's experiments.

Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled Biotronics: The Silver Species. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: The Biotronics Project, Joey Lawsin, 1988, USA.

================================================================== 
The Homotronics® and Homodruinos® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®
 ==================================================================

No comments:

Post a Comment