Difference between revisions of "Shared:Group 2"

From ip
Jump to: navigation, search
(Voice Recognition Sensors)
 
Line 1: Line 1:
 
//what this sensor does is that it recognizes certain commands.
 
//what this sensor does is that it recognizes certain commands.
//before the commands you will have to call the sensor by name to let it know it should be ready to work.
+
 
//if you have not given settings to the sensor, you say "hi sensor" before your commands.
+
before the commands you will have to call the sensor by name to let it know it should be ready to work.
//it can recognize commands under *voiceBuffer, and will repeat it after recognition.
+
 
 +
if you have not given settings to the sensor, you say "hi sensor" before your commands.
 +
 
 +
it can recognize commands under *voiceBuffer, and will repeat it after recognition.
  
 
#include <RGBdriver.h>
 
#include <RGBdriver.h>

Revision as of 18:50, 18 April 2017

//what this sensor does is that it recognizes certain commands.

before the commands you will have to call the sensor by name to let it know it should be ready to work.

if you have not given settings to the sensor, you say "hi sensor" before your commands.

it can recognize commands under *voiceBuffer, and will repeat it after recognition.

  1. include <RGBdriver.h>
  1. include <SoftwareSerial.h>
  1. define SOFTSERIAL_RX_PIN 2
  2. define SOFTSERIAL_TX_PIN 3

SoftwareSerial softSerial(SOFTSERIAL_RX_PIN,SOFTSERIAL_TX_PIN);

const char *voiceBuffer[] = {

   "Turn on the light",
   "Turn off the light",
   "Play music",
   "Pause",
   "Next",
   "Previous",
   "Up",
   "Down",
   "Turn on the TV",
   "Turn off the TV",
   "Increase temperature",
   "Decrease temperature",
   "What's the time",
   "Open the door",
   "Close the door",
   "Left",
   "Right",
   "Stop",
   "Start",
   "Mode 1",
   "Mode 2",
   "Go",

};

void setup() {

   Serial.begin(9600);
   softSerial.begin(9600);
   softSerial.listen();

}

void loop() {

   char cmd;
   if(softSerial.available())
   {
       cmd = softSerial.read();
       Serial.println(voiceBuffer[cmd - 1]);
   }

}