Vous êtes sur la page 1sur 23

Speech Recognition Calculator

ECE 4007 Section L02 - Group 08 Alfredo Herrera John Holmes Josh Liang Alex Kee

Table of Contents
Introduction..........................................................................................................................3 De ign !pproach.................................................................................................................4 "ard#are..............................................................................................................................$ "ard#are !pproach.........................................................................................................$ "ard#are Detail .............................................................................................................% "ard#are Change to &riginal De ign............................................................................7 So't#are...............................................................................................................................8 !rduino (icrocontroller )rogra**ing...........................................................................8 Graphical + er Inter'ace................................................................................................,, (ar-eting !pproach..........................................................................................................,4 Co t !nal. i .................................................................................................................,4 !ppendi/ !........................................................................................................................,% !ppendi/ 0........................................................................................................................,8 !ppendi/ C........................................................................................................................2, 1or- Cited.......................................................................................................................23

Introduction
Calculator on toda.2 *ar-et in u''icientl. acco**odate the need o' li*ited *o3ilit. people. Li*ited *o3ilit. people are t.picall. cla i'ied a people #ho* ha4e di''icult. #ith preci e *o4e*ent uch a 3utton pre e on *all electronic . Currentl. the *ar-et 'or calculator ai* to#ard li*ited 4i ion con u*er 3. either enlarging the ur'ace area o' 3utton and5or 3. adding 4oice 'eed3ac- #hen 3utton are pre ed. 1hile uch olution *itigate the pro3le*6 the. 'ail to co*pletel. addre the pro3le* li*ited *o3ilit. con u*er encounter. Clearl.6 a 3etter olution i to co*pletel. re*o4e an. ph. icall. interaction #ith the de4ice. 7oice recognition *a-e thi po i3le. 8hrough peech u er can operate uch a de4ice #ith ea e and accurac.9 li*ited *o3ilit. u er no longer ha4e to 'u*3le around #ith 3utton pre e #hich re:uire 4er. preci e *otor -ill . 8.picall. 4oice recognition i a ociated #ith auto*ated telephone . te* 6 #here u er pea- to the . te* a a *ean 'or data input. 1hen u er are pea-ing to the . te*6 there i no direct 'eed3ac- o' peech detected. ! a re ult6 the u er *u t #ait 'or the . te* to 4eri'. correct data input at the end o' a e:uence o' data. 8here'ore6 4oice recognition i*ple*entation are -no#n to 3e inaccurate and ti*e con u*ing. &ur approach to the e i ue i to pro4ide real ti*e 4i ual 'eed3ac- o' data po-en. 8hi allo# u er to correct *i recogni;ed #ord in real ti*e. In addition6 all preconcei4ed notion o' 4oice recognition re:uire o*e pre-operation training in order 'or accurate recognition. "o#e4er 3. i*ple*enting a *ean o' pea-er independence6 peech recognition #ithout an. pre-operation training6 a li*itle nu*3er o' di''erent u er can operate the de4ice #ith relia3le accurac.. 8he pri*ar. goal o' thi pro<ect #a to addre pit'all o' e/i ting product . 8hi *ethodicall. #ill 3e i*ple*ented in the de ign o' our Speech Recognition Calculator =SRC>6 allo#ing u to co*pletel. cater to the need o' our intended audience. 0e ide the 3a ic operation o' the 4oice recognition calculator6 #e ought to pro4ide additional 'eature to upple*ent learning and to ea e operation. 8he e include re*ote connecti4it. option and a LCD di pla.. 8he o3<ecti4e o' re*ote connecti4it. i to allo# a tutor to re*otel. interact #ith a tudent. ! tutor can input e:uation that *u t 3e ol4ed 3. the tudent. 8he u e o' a LCD di pla. #ill add additional 4i ual 'eed3ac- to the u er.

Design Approach
! #ith all 4oice recognition . te* 6 the . te* i co*po ed o' three *ain co*ponent ? 4oice recognition6 *icroproce or6 and u er inter'ace. 8he *icroproce or handle the co**unication 3et#een the 4oice recognition and u er inter'ace6 a ho#n in @igure ,. 8he *icroproce or i controlled #ith the C progra**ing language and proprietar. li3rarie #hich allo# control o' the data pin on the *icroproce or. 8ho e data pin pro4ide a *ean o' co**unication 3et#een the 4oice recognition co*ponent and the *icroproce or. 8he data 'lo# 'ro* the 4oice recognition co*ponent and *icroproce or i unidirectional6 a the data can onl. 3e read 'ro* the 4oice recognition co*ponent . ! a re ult6 the *icroproce or *u t per'or* the 'ollo#ing 'unction ? decoding o' data ignal 6 *anipulation o' the decoded ignal 6 and control o' data tran *i ion to the u er inter'ace. 8he u er inter'ace pro4ide real ti*e 4i ual 'eed3ac- o' po-en #ord and the arith*etic calculation .

Figure 1. "igh le4el o4er4ie# o' interaction 3et#een 4oice recognition co*ponent 6 *icrocontroller6 and u er inter'ace.

Hardware
"ard#are !pproach
8he SRC . te* i di4ided into three *ain co*ponent ? a graphical u er inter'ace =G+I>6 a peech recognition co*ponent6 and a *icroproce or core. 8he G+I i i*ple*ented in the o't#are de ign. 8he *icrophone6 analog 'ilter6 peech recognition integrated circuit ="(2007>6 and the SR!( con titute the peech recognition co*ponent . 8he *icrocontroller u ed i an !rduino proce or. @igure 2 i a che*atic o' the data interaction 3et#een the indi4idual co*ponent that contri3ute to the SRC de ign. 8he arro# denote 'lo# o' data.

Figure 2: 0loc- diagra* ho#ca ing peech recognition calculator.

"ard#are Detail
Speech Recognition Integrated Circuit (HM2 !" 8he "(2007 i the chip that u e a ingle C(&S tran i tor that anal.;e the analog ignal o3tained 'ro* the *icrophone A,B. Speech ignal are captured #ith a *icrophone #hich are then 'iltered and con4erted into a digital ignal 3. an analog 'ilter. 8he peech ignal *u t 3e 'iltered to re*o4e an. 're:uencie out ide the range o' nor*al peech. @iltering certain 're:uencie al o reduce the 3and#idth o' the peech ignal re ulting in le re:uired co*putation po#er. Depending on the operation o' the "(2007 =training or recognition *ode>6 data i either #ritten to or read 'ro* the SR!(. 8he SR!( i di4ided into data 3an- #here each data 3an- ha it o#n uni:ue 8 3it 3inar. 4alue. I' the "(2007 i in recognition *ode6 the "(2007 #ill atte*pt to *atch the peech ignal #ith the entrie in the SR!( and return the corre ponding data 3an-2 8 3it 3inar. 4alue on it data 3u . I' no *atch i detected6 a re er4ed 8 3it 4alue i tran *itted. 1hen the "(2007 *atche the recei4ed peech ignal to a peci'ic tored phra e o' #ord6 the corre ponding 8 3it 4alue #ill 3e con tantl. held on the eight pin o' the data 3u . 8he 8 3it 4alue #ill onl. change #hen the "(2007 recogni;e a di''erent peech ignal. 8here'ore6 the 4oice recognition co*ponent #ill al#a. tran *it a ignal o' the la t peech ignal recogni;ed. Arduino Microcontroller !rduino i an open- ource electronic protot.ping plat'or* 3a ed on 'le/i3le6 ea .-to-u e hard#are and o't#are A2B. 8he !rduino *icrocontroller i e ential to the de ign o' the SRC a it pro4ide co**unication 3et#een the 4oice recognition co*ponent and the graphical u er inter'ace =G+I>. 8he 8 3it data 3u pro4ide co**unication 3et#een the *icroproce or and the "(2007. !'ter !rduino *icroproce or read the 8 3it data 3u 6 the progra**ed *icrocontroller #ill decode and *anipulated the 8 3it ignal . !'ter proce ing the 8 3it ignal 6 the !rduino *icrocontroller end the !SCII e:ui4alent o' the po-en #ord or phra e through a +S0 connection to the G+I. 8he G+I i #ritten in the #rocessing language6 #hich i 3a ed on Ca4a. 8he detail o' the o't#are u ed to progra* the !rduino *icrocontroller and the G+I #ill 3e di cu ed in later ection .

"ard#are Change to &riginal De ign


1hile #e ha4e *et our goal 3. nearl. eli*inating all ph. ical u er interaction6 o*e propo ed 'eature 'ailed to 3e included in our 'inal de ign. 8he original hard#are elected 'or thi pro<ect did not operate in a relia3le *anner. ! a re ult6 ne# hard#are had to 3e elected. 8he ne#er hard#are doe not ha4e the a*e connecti4it. or 'le/i3ilit. a the original. "o#e4er6 it doe 'unction in a *ore relia3le *anner. ! planned6 our calculator #a uppo ed to 3e a3le to 'eature pea-er independence. Spea-er independence #a uppo ed to allo# an arra. o' u er to 3e a3le to u e the calculator #ithout training. "o#e4er6 e/ten i4e 3ench*ar- te t ho# that pea-er independence i not entirel. achie4a3le #ith the current peech recognition chip ="(2007>. 8he current de ign approach 'or the Speech Recognition Calculator #a not the 'ir t de ign iteration. 8he original propo ed plan #a to con truct an original 4oice recognition circuitr.. 8he original circuitr. #a co*pri ed o' ingle pac-age "(2007 and SR!( IC chip and a *icrocontroller a e*3led on a 3read3oard. In addition6 LED #ere u ed in order to help 'or de3ugging and tatu indicator . 8he e co*ponent are identical to the prepac-aged "(2007 currentl. e*plo.ed. +nli-e our current de ign6 the 0a ic Sta*p *icrocontroller #a pre4iou l. u ed rather than the !rduino *icroproce or. Ideall.6 the de ign #ith either *icroproce or hould per'or* identicall.6 3ut thi #a not the ca e. &ne o' pro3le* #ith thi de ign #a that the 0a ic Sta*p did not recogni;e the ignal that #a in the output 'ro* the "(2007. (oreo4er6 the 0a ic Sta*p chip could not *anipulate the in'or*ation that #a in ide the "(2007. In other #ord 6 #e could not get the "(2007 inter'ace #ith the 0a ic Sta*p chip. !nother pro3le* 'aced #a the circuitr. it el'. !lthough care #a ta-en #hen connecting all the #ire 6 there #ere too *an. #ire and po i3ilitie 'or error. It #a 4er. di''icult to de3ug the circuit. 8he circuit #a 3uilt *ore than a do;en ti*e in order to ee i' there #a a 3ug in the circuitr.. In the end6 the circuit ne4er #or-ed. @inall.6 the LED that #ere uppo ed to light up #hene4er recognition occurred #ould light up at rando* inter4al 6 *a-ing de3ugging nearl. i*po i3le.

Software
!rduino (icrocontroller )rogra**ing
$%er%ie& 8he !rduino *icrocontroller i progra**ed #ith !rduino2 proprietar. co*plier. 8he co*plier i 3a ed o'' o' the C progra**ing language. Included #ith the co*plier i !rduino2 propriet. li3rarie #hich allo# the progra**er to acce to the e/ternal pin o' the *icrocontroller. !rduino2 co*plier ha t#o re er4ed 'unction . 8he e t#o 'unction are na*ed etup= > and loop= >. 8he 'unction6 called etup= >6 i al#a. e/ecuted #hen the !rduino *icrocontroller i initiali;ed. 8he loop= > 'unction i continuall. e4aluated #hile the !rduino *icrocontroller i running i**ediatel. a'ter the etup= > 'unction. 'asic Algorithm 1ithin the etup= > 'unction6 the eight pin on the *icrocontroller are e ta3li h a input . 8hi allo# the eight pin to en e digital logic le4el tran *itted 3. the 4oice recognition co*ponent . 8hi etup 'unction al o e ta3li he the data rate at #hich the erial 3u #ill 3e tran *itted or recei4ed data. 8he erial 3u i the co**unication lin3et#een the *icrocontroller and the graphical u er inter'ace. 8here'ore6 an. data #ritten on to the erial 3u 3. the *icrocontroller #ill 3e read 3. the graphical u er inter'ace6 and 4i e 4er a. 8he loop= > 'unction #ill handle all the decoding o' data 'ro* the 4oice recognition co*ponent and tran *i ion o' data to the graphical u er inter'ace. 8hi 'unction #ill 3egin 3. reading the eight pin on the *icrocontroller. Since the 4alue held on eight pin corre pond to a peci'ic phra e or #ord tored in the SR!(6 the loop= > 'unction #ill decode that phra e or #ord into it !SCII 4alue. 8hat !SCII 4alue #ill 3e tran *itted to the graphical u er inter'ace o4er the erial 3u . 8hi *ethodicall. #ill 3e repeated continuou a'ter the etup= > 'unction i e/ecuted. 8hi i the 3a ic algorith* o' the !rduino *icrocontroller. Modifications to 'asic Algorithm ! noted a3o4e in the D"ard#are Detail 2 ection6 the 4oice recognition . te* #ill continuall. tran *it the eight 3it 4alue o' the la t recogni;ed phra e or #ord. Since the loop= > 'unction i con tantl. e4aluated6 the 3a ic algorith* #ill con tantl. tran *it a !SCII 4alue to the graphical u er inter'ace. ! a re ult6 e4en i' the 4oice recognition . te* ha not recogni;ed an. ne# phra e or #ord 6 the la t recogni;ed #ord i till

tran *itted6 due to the 'act the 4oice recognition . te* #ill continue to tran *it it la t recogni;ed phra e or #ord. In order to decrea e the a*ount o' data 'lo# to the graphical u er inter'ace6 a deci ion loop *u t 3e added. E4er. ti*e the loop= > 'unction i ran6 thi deci ion loop #ill tore the current decoded !SCII 4alue and the pre4iou decoded !SCII 4alue o' the la t e4aluation o' the loop= > 'unction. 1hen the pre4iou and current !CSII 4alue di''er 6 thi *ean a ne# phra e or #ord ha 3een recogni;ed. ! a re ult6 thi ne# !CSII 4alue #ill 3e tran *itted o4er the erial 3u . 8he high le4el 'lo#chart i ho#n in @igure 3. !ppendi/ 0 i the code u ed to progra* the !rduino *icrocontroller.

Figure : !rduino progra**ing o't#are 'lo#.

,0

Graphical + er Inter'ace
8he #rocessing language i 3a ed on the Ca4a language and place an e*pha i on Fi*age 6 ani*ation6 and interaction G A/B. Gi4en #rocessing2 co*pati3ilit. #ith the ideal o' the SRC =u er-'riendline and graphical interaction>6 the language #a elected to handle *o t o' the high-le4el 'unction . 8he high-le4el 'unction include the G+I di pla. and co*putation algorith* . $%er%ie& 8he #rocessing progra* #or- at the top *o t la.er o' the o't#are de ign olution u ed 'or the SRC = ee @igure 4>. 8he progra* re ide on a )C =per onal co*puter> #ith the appropriate operating . te* =Linu/6 1indo# 6 or (ac &S H>6 and Ca4a 4irtual *achine. 8he C progra* i i*ple*ented in C and progra**ed into the !rduino2 !t*el *icrocontroller. 8he data 'lo# 3et#een the t#o la.er i 3idirectional u ing a C&( Serial port.

Figure !: So't#are la.er .

8he #rocessing progra* it el' i co*po ed o' three co*ponent ? erial co**unication6 di pla. G+I6 and co*putation. ! che*e 'or erial co**unication #a nece ar. in order to inter'ace #ith the C code. 8he di pla. G+I #a et up to pro4ide the u er #ith a 'riendl. and ea .-to-read 4i ual 'eed3ac- . te*. 8he co*putation algorith* ta-e care o' the 3a ic arith*etic 'unction o' the calculator.

,,

Serial Communication Serial co**unication are e ta3li hed 3et#een the C progra* and #rocessing progra* 4ia the creation o' a Serial o3<ect in the #rocessing code. ! E%00 3p 3aud rate i u ed 'or co**unication to achie4e a #ider range o' co*pati3ilit.6 a peed i o' little i*portance. @igure $ ho# the e:uence in #hich erial co**unication ta-e place.

Figure ": )roce ing o't#are 'lo#.

8he deli*iter i nece ar. in order to pro4ide the u er #ith 'eed3ac- #hile inter'acing #ith the SRC. 8he #rocessing di pla. G+I #ill not di pla. another nu*3er or operator until the deli*iter ha 3een po-en 3. the u er =u uall. the #ord F&IG>. In addition6 the re ult o' a co*putation #ill not 3e di pla.ed until a -e.#ord ha 3een po-en =u uall. the #ord FEJ+!LG>. @or e/a*ple6 the e:uation 2K2 can 3e e4aluated u ing the 'ollo#ing che*e6 F2G6 F&IG6 F2G6 F&IG6GEJ+!LSG6 F&IG #hich #ill cau e the calculator to di pla. the nu*3er 2. ()I *ispla+ ! igni'icant a*ount o' re earch #a in4e ted in the de ign o' the G+I di pla.6 gi4en that the SRC i intended 'or all di a3ilit. t.pe 6 including tho e patron #ith lo#-4i ion. ! tud. 3. "ill and Schar'' ugge t the 3e t 'ont color6 'ont t.le6 'ont t.pe6 and 3ac-ground color co*3ination a green italici;ed 8i*e Le# Ro*an on a .ello# 3ac-ground. Ahttp?55hu3el. 'a u.edu5re earch5!"LC+R.ht*lB. 8he G+I 'eature a high ,2

contra t6 high 4i i3ilit. di pla. #ith i*ilar attri3ute a tho e *entioned a #ell a a large 'ont i;e in order to aid 4i ual u er 'eed3ac-. Computation &nce the peech data ha 3een read and interpreted 'ro* the erial 3u 3. the #rocessing code6 the #rocessing progra* tore the data into a 4ector arra. a a *ean o' *e*or. torage. &nce the -e.#ord FEJ+!LSG ha 3een pic-ed up 3. the progra*6 the 4ector arra. i proce ed and a re ult i ent to the G+I di pla.. 8he 4ector arra. i par ed ele*ent-3.-ele*ent6 and a 4aria3le tore a running total. 1hen an arith*etic operator i encountered in the 4ector arra.6 t#o input are ent to a *ethod corre ponding to the operation to 3e per'or*ed =addition6 u3traction6 di4i ion6 etc.>. 8he *ethod per'or* the co*putation and then return the re ult a a ingle 4aria3le. ,rror-chec.ing Error-chec-ing i per'or*ed on-the-'l. 4ia a 0oolean tate 4aria3le that deter*ine #hether or not t#o arith*etic operator ha4e 3een po-en con ecuti4el.. I' thi i the ca e6 the #rocessing code #ill accept the la t po-en operator. !ppendi/ C i the code 'or creating the <a4a G+I.

,3

#ar$eting Approach
8he *ar-et 'or li*ited *o3ilit. people ha ne4er 3een ade:uatel. addre ed. Li*ited *o3ilit. people ha4e al#a. 3een e/cluded 'ro* u ing 'or* o' in tru*entation #hich re:uire preci e *otor *o4e*ent uch a 3utton pre e on *all electronic uch a handheld calculator . 8he *ar-et 'or calculator ai* to#ard li*ited 4i ion con u*er 3. either enlarging the ur'ace area o' 3utton and5or 3. adding 4oice 'eed3ac- #hen 3utton are pre ed. 1hile uch olution help u er #ith li*ited 4i ion6 the. 'ail to co*pletel. addre the pro3le* 'or li*ited *o3ilit. u er . 8he onl. co*plete olution i to co*pletel. re*o4e ph. icall. interaction #ith the de4ice. 1ith 4oice recognition technolog.6 thi i no# po i3le. 8he SRC calculator i an all-in-one6 di a3ilit.-'riendl. calculator that introduce a hand 'ree6 peech recognition and peech 'eed3ac- . te*. 8he calculator can al o 3e u ed to re*otel. tutor u er . Since production option on the *ar-et i currentl. 4er. li*ited6 the co t o' the calculator hould not i*pede *ar-et ucce . 8he unit co t o' an SRC calculator #ill 3e around M28$. (an. e/i ting peech recognition calculator product on the *ar-et toda. are o't#are product 'or laptop or de -top co*puter . 8he co*peting &rion peech recognition calculator retail 'or around M280. 8hi o''er an ad4antage 'or the SRC 3ecau e it o''er a co*para3le *ar-et co t #ith uperior 'eature . 8he SRC #ill 3e the onl. product on the *ar-et #hich #ill 'eature hand 'ree peech recognition capa3ilitie . 8he SRC #ill o''er unparalleled upport 'or u er #ith thi re:uire*ent.

Co t !nal. i
! een in 8a3le !46 the inclu ion o' the !rduino 3oard into the o4erall SRC calculator de ign ha lo#ered the co t o' all *aterial to appro/i*atel. M23,. I' the una e*3led I*age Co SR-0% circuit -it i purcha ed and *a a e*3led6 the co t o' o4erall *aterial #ould 3e lo#ered dra ticall. #hen the SRC i *a *anu'actured. Since the pre-a e*3led I*age Co SR-07 circuit -it #a purcha ed to create the protot.pe6 it i -no#n that the de ign #ill #or- 'la#le l. #ith the SRC. 8he SR-07 Speech Recognition circuit i e entiall. the a e*3led and te ted SR-0% -it. (a a e*3l. and te ting #ill 3e included in the total co t o' *anu'acturing. 8he co t o' the SR-07 -it #a M,7E.E$ and the co t o' the SR-0% -it i M,,4.E$. 8hi #ill allo# the unit co t to drop 3. M%$.00. !t a unit price o' M28$6 there #ill 3e an e4en *ore igni'icant *argin o' pro'it. 8he o4erall la3or co t6 3a ed on the alarie o' 'our entr. le4el engineer at M2% an hour 'or ,00 hour each i deter*ined to 3e M,06400. 1ith all the co t o' o4erhead6 'ringe6

,4

and ale 6 the ale o' ,006000 unit at a price o' M28$ allo# 'or a M,3.% *illion dollar pro'it. 8a3le outlining the detail o' co t anal. i *a. 3e 'ound in !ppendi/ !.

,$

Appendi% A

Table A1. SRC )RICE C!LC+L!8I&LS


S&C '&IC( CA)C*)ATI+,S Fringe Benefits Overhead Sales Expense 30% o' la3or 120% o' *aterial 6 la3or N 'ringe 10% o' elling price

Table A2. La3or Co t


)abor Cost Engineer , =,00 hr / M2%> Engineer 2 Engineer 3 Engineer 4 Total Labor Cost

M26%00 M26%00 M26%00 M26%00 10!"00

Table A . De4elop*ent Co t
De-elop.ent Cost #arts Labor @ringe 0ene'it 6 O o' La3or Su3total &4erhead6 O o' (atl6 La3or N @ringe Total 231 10!"00 M36,20 M,367$, M,%6$0, ""!003

,%

Table A!. 0ill o' (aterial 'or , +nit


/ill of #aterials for 1 *nit "(2007 8I / 8 SR!( 74LS373 7448 / 2 LCD Di pla. !rduino (icrocontroller 0oard Ie.pad )roto3oard (icrophone 1ire 6 Re i tor 6 and Capacitor )aralla/ Internet Let3urner Iit Total

M,0 M8.8$ M0.80 M,.$0 M20 M4E M,0 M,$ M$ M,2 MEE 231

Table A". Deter*ination o' Selling )rice


Deter.ination of Selling 'rice 0a ed on? #arts Cost $sse%bl& Labor Testing Labor 8otal La3or @ringe 0ene'it 6 O o' La3or Su3total &4erhead6 O o' (atl6 La3or N @ringe Su3total6 Input Co t Sale E/pen e !*orti;ed De4elop*ent Co t Su3total6 !ll Co t )ro'it Selling #ri'e (et #rofit 100!000 unit

231 30 10 M40 M,2 M283 M340 M,20 M2E M0 M,4E ,3% 2)* 13!+00!000

,7

Appendi% /

55declare our *ethod and 4aria3le int Read(atch)in=>9 3oolean Co*parer=intAB6 intAB>9 55the pin #e read int pin AB P Q26 36 %6 76 86 E6 46 $R9 55our *a int *a -A,0BA8B P Q Q,6,606,6,6,6,6,R6 55Q,6 06 06 06 06 06 06 0R6 55;ero -S &I 3utton Q,6 06 06 06 06 ,6 06 0R6 55one Q,6 06 06 06 ,6 06 06 0R6 55t#o Q,6 06 06 06 ,6 ,6 06 0R6 55three Q,6 06 06 ,6 06 06 06 0R6 55'our Q,6 06 06 ,6 06 ,6 06 0R6 55'i4e Q,6 06 06 ,6 ,6 06 06 0R6 55 i/ Q,6 06 06 ,6 ,6 ,6 06 0R6 55 e4en Q,6 06 ,6 06 06 06 06 0R6 55eight Q,6 06 ,6 06 06 ,6 06 0R6 55nine R9 4oid etup=> Q 55 et pin a input 'or=int iP09 iTP79 iKK>Q pin(ode=pin AiB6 IL)+8>9 R 3eginSerial=E%00>9 R char co**and9 4oid loop=>Q int 4alue9 int te*p7alue9 int pre4iou 7alue9 3oolean 'ir t8i*e P true9 3oolean 'ir tSend P true9

,8

co**and P erialRead=>9 i'=co**and PP UrU>Q doQ te*p7alue P Read(atch)in =>9 i'=te*p7alue S 0>Q 4alue P te*p7alue9 i'='ir t8i*e>Q pre4iou 7alue P 4alue9 'ir t8i*e P 'al e9 R i'=pre4iou 7alue VP 4alue>Q 'ir tSend P true9 R i'='ir tSend>Q erial1rite=4alueK48>9 55a cii 4alue printLe#line=>9 'ir tSend P 'al e9 R pre4iou 7alue P 4alue9 R co**and P erialRead=>9 55 top R#hile=co**and VP U U>9 R R int Read(atch)in =>Q int pin7alue A8B9 3oolean 'ound P 'al e9 'or=int iP09 iTP79 iKK>Q pin7alue AiB P digitalRead=pin AiB>9 R int inde/ P 09 int *atched7alue9 doQ i'=Co*parer=pin7alue 6 *a -Ainde/B>>Q 'ound P true9 *atched7alue P inde/9 R inde/KK9 55condition #here nothing i *atched returned 4alue i -, i'=inde/ S E>Q 'ound P true9 *atched7alue P -,9

,E

R R#hile=V'ound>9 return *atched7alue9 R 3oolean Co*parer=int aAB6 int 3AB>Q 3oolean *atched P true9 'or=int iP09 iTP79 iKK>Q i'=aAiB VP 3AiB>Q *atched P 'al e9 R R return *atched9 R

20

Appendi% C

55I*port li3rarie i*port proce ing. erial.W9 55Declaration String inString P ne# String=X X>9 55 Input tring 'ro* erial port? String pString P ne# String=X,X>9 String holder P ne# String=X,X>9 Serial *.)ort9 55 8he erial port? )@ont 'ont!9 55 8he di pla. 'ont? int e:ual P UPU9 55 !SCII e:ual 55 Set the le't and top *argin int *argin P %9 int gap P 309 4oid etup=> Q i;e=%006 %00>9 3ac-ground=0>9 'ont! P load@ont=XCourierLe#3%.4l#X>9 te/t@ont='ont!6 48>9 te/t!lign=LE@8>9 55 Li t all the a4aila3le erial port ? 55println=Serial.li t=>>9 55Select econd erial port =te ted on CohnU co*puter and ee* to 3e t.pical> *.)ort P ne# Serial=thi 6 Serial.li t=>A,B6 E%00>9 55Read 3u''er until #e hit the e:ual character 55*.)ort.3u''er+ntil=e:ual>9 R

4oid dra#=> Q 2,

*.)ort.#rite=,,4>9 55 tart the Serial co**unication 55*.)ort.#rite=,,$>9 cau e pa**ing holder P =*.)ort.readString=>>9 55te*porar. holder *.)ort.clear=>9 i' ==holder VP null> > Q inString P inString.concat=holder>9 print=inString>9 R dela.=2000>9 R 4oid tring)ar e=String p> Q i' =p.inde/&'=XKX> VP -,> 55te t 'or addition Q R R

22

0or$s Cited

A,B

I*age Scienti'ic In tru*ent Inc.6 F"o# to 0uild a Speech Recognition Circuit6G Images Scientific Instruments Inc/ A&nlineB. !4aila3le? http?55###.i*age co.co*5article 5h*20075SpeechRecognition8utorial0,.ht*l. A!cce ed? Dec. ,6 2007B. !rduino inc.6 F!rduino 0oardG6 A&nlineB. !4aila3le? http?55###.arduino.cc5. A!cce ed? Dec. ,6 2007B. 0. @r. and C. Rea 6 X)roce ing6X A&nline docu*entB6 20076 !4aila3le "88)? http?55###.proce ing.org5 !.L. "ill and L.@.7. Schar''6 XReada3ilit. &' 1e3 ite 1ith 7ariou @oreground50ac-ground Color Co*3ination 6 @ont 8.pe !nd 1ord St.le 6X A&nline docu*entB6 ,EE76 !4aila3le "88)? http?55hu3el. 'a u.edu5re earch5!"LC+R.ht*l

A2B A3B A4B

23

Vous aimerez peut-être aussi