#include <EEPROM.h> #include <Wire.h> #include <SoftwareSerial.h> #include <LiquidCrystal.h> SoftwareSerial voice = SoftwareSerial(15, 16); LiquidCrystal lcd(5, 6, 7, 8, 9, 10); int pulses, A_SIG=0, B_SIG=1, menu=0, datacount, i, buttoncount=0; int count, j, k, m, ready=0, even=0, fail, first_but=0, second_but=0; word Power[100]; word Remote[100]; //word Remote2[100]; word mute_remote[100]; word enter_remote[100]; byte datlow, dathigh, addlow, addhigh; long Start, Stop; char voice_response, voice_response_mem='#', status_in[8]; char upletter[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; long timeout; void setup(){ attachInterrupt(0, A_RISE, RISING); attachInterrupt(1, B_RISE, RISING); pinMode(11, OUTPUT);//IR_Encoder_Interrupt Select pinMode(12, OUTPUT);//EncoderLED GREEN pinMode(13, OUTPUT);//EncoderLED RED pinMode(14, INPUT);//Button Active Low pinMode(15, INPUT);//TX from Voice pinMode(16, OUTPUT);//RX to Voice pinMode(4, OUTPUT);//IR LEDs digitalWrite(11, LOW);//low-encoder high-IR receiver Serial.begin(115200); voice.begin(9600); Wire.begin(); lcd.begin(16, 2); buttoncount = EEPROM.read(0); lcd.print("Voice Remote"); lcd.setCursor(0,1); lcd.print(buttoncount); lcd.print(" Commands"); delay(2000); voice_start(); //voice.print('b');//break //voice_status(); }//setup void loop(){ lcd.clear(); if(pulses>=30 && menu==0) pulses=30; if(pulses>=60 && menu==1) pulses=60; if(pulses<0) pulses=0; if(pulses>=10 && pulses<=20 && menu==0){ lcd.print("Program Mode?"); if(digitalRead(14)==LOW){ delay(500); lcd.clear(); pulses=0; menu=1;} } if(pulses>=0 && pulses<10 && menu==0){ lcd.print("Listen Mode?"); if(digitalRead(14)==LOW){ delay(500); pulses=0; menu=2;} } if(pulses>=20 && pulses<=30 && menu==0){ lcd.print("Reboot?"); if(digitalRead(14)==LOW){ delay(500); voice_start();} }
For more detail: How to Build an Arduino Voice Controlled TV Remote